Add custom.ini

This commit is contained in:
Unknown 2014-03-10 23:03:17 -04:00
parent 52837e3d36
commit 6ce9d800d0
4 changed files with 14 additions and 18 deletions

View file

@ -11,6 +11,7 @@ import (
"path"
"path/filepath"
"github.com/Unknwon/com"
"github.com/Unknwon/goconfig"
)
@ -36,11 +37,20 @@ func init() {
os.Exit(2)
}
cfgPath := filepath.Join(workDir, "conf", "app.ini")
cfgPathPrefix := filepath.Join(workDir, "conf")
cfgPath := filepath.Join(cfgPathPrefix, "app.ini")
Cfg, err = goconfig.LoadConfigFile(cfgPath)
if err != nil {
fmt.Printf("Cannot load config file '%s'\n", cfgPath)
os.Exit(2)
}
cfgPath = filepath.Join(cfgPathPrefix, "custom.ini")
if com.IsFile(cfgPath) {
if err = Cfg.AppendFiles(cfgPath); err != nil {
fmt.Printf("Cannot load config file '%s'\n", cfgPath)
os.Exit(2)
}
}
Cfg.BlockMode = false
}