工作目录bug修复
This commit is contained in:
+2
-9
@@ -40,15 +40,8 @@ func main() {
|
||||
common.PrintVersion()
|
||||
return
|
||||
}
|
||||
|
||||
if len(os.Args) <= 1 {
|
||||
if err := beego.LoadAppConfig("ini", filepath.Join("./", "conf", "nps.conf")); err != nil {
|
||||
log.Fatalln("load config file error", err.Error())
|
||||
}
|
||||
} else {
|
||||
if err := beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf")); err != nil {
|
||||
log.Fatalln("load config file error", err.Error())
|
||||
}
|
||||
if err := beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf")); err != nil {
|
||||
log.Fatalln("load config file error", err.Error())
|
||||
}
|
||||
|
||||
common.InitPProfFromFile()
|
||||
|
||||
+6
-2
@@ -11,8 +11,12 @@ import (
|
||||
//windows system, select the C:\Program Files\nps as config directory if exist, or select ./
|
||||
func GetRunPath() string {
|
||||
var path string
|
||||
if path = GetInstallPath(); !FileExists(path) {
|
||||
return GetAppPath()
|
||||
if len(os.Args) <= 1 {
|
||||
return "./"
|
||||
} else {
|
||||
if path = GetInstallPath(); !FileExists(path) {
|
||||
return GetAppPath()
|
||||
}
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user