Merge pull request #613 from xiexiao/master

Windows服务运行npc时读取程序目录下的config文件
pull/648/head
ffdfgdfg 2020-10-05 19:25:19 +08:00 committed by GitHub
commit 22e1eabb55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -239,7 +239,7 @@ func run() {
}()
} else {
if *configPath == "" {
*configPath = "conf/npc.conf"
*configPath = common.GetConfigPath()
}
go client.StartFromFile(*configPath)
}

View File

@ -76,3 +76,14 @@ func GetTmpPath() string {
}
return path
}
//config file path
func GetConfigPath() string {
var path string
if IsWindows() {
path = filepath.Join(GetAppPath(), "conf/npc.conf")
} else {
path = "conf/npc.conf"
}
return path
}