From 330b3b193118b58cd442e8004532d48033035cea Mon Sep 17 00:00:00 2001 From: youngsterxyf Date: Wed, 27 Jan 2016 00:17:56 +0800 Subject: [PATCH] enhancement code --- config.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config.go b/config.go index 246c53f0..a86ad34c 100644 --- a/config.go +++ b/config.go @@ -20,6 +20,7 @@ import ( "path/filepath" "strings" "fmt" + "errors" "github.com/astaxie/beego/config" "github.com/astaxie/beego/session" @@ -313,6 +314,11 @@ func LoadAppConfig(configPath string, adapterName string) error { if err != nil { return err } + + if !utils.FileExists(absConfigPath) { + return errors.New(fmt.Sprintf("the target config file: %s don't exist!", configPath)) + } + if absConfigPath == AppConfigPath { return nil }