1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-23 04:20:54 +00:00

fix test error

This commit is contained in:
coseyo 2016-01-24 00:40:03 +08:00
parent 4c1cfc1386
commit 3031bdd176

View File

@ -185,18 +185,17 @@ func ParseConfig() (err error) {
workPath, _ := os.Getwd() workPath, _ := os.Getwd()
workPath, _ = filepath.Abs(workPath) workPath, _ = filepath.Abs(workPath)
if workPath != AppPath {
os.Chdir(AppPath)
}
if AppConfigPath == "" { if AppConfigPath == "" {
// initialize default configurations // initialize default configurations
AppConfigPath = filepath.Join(AppPath, "conf", "app.conf") AppConfigPath = filepath.Join(AppPath, "conf", "app.conf")
if !utils.FileExists(AppConfigPath) { if utils.FileExists(AppConfigPath) && workPath != AppPath {
os.Chdir(AppPath)
} else {
AppConfig = &beegoAppConfig{config.NewFakeConfig()} AppConfig = &beegoAppConfig{config.NewFakeConfig()}
return return
} }
} }
AppConfig, err = newAppConfig(AppConfigProvider, AppConfigPath) AppConfig, err = newAppConfig(AppConfigProvider, AppConfigPath)
if err != nil { if err != nil {
return err return err