工作目录bug修复

This commit is contained in:
yisier
2022-10-31 10:40:47 +08:00
parent c0667e2dca
commit b6e33d3bd5
2 changed files with 8 additions and 11 deletions
+2 -9
View File
@@ -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
View File
@@ -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
}