diff --git a/cmd/npc/npc.go b/cmd/npc/npc.go index 7467c2d..c8ba935 100644 --- a/cmd/npc/npc.go +++ b/cmd/npc/npc.go @@ -239,7 +239,7 @@ func run() { }() } else { if *configPath == "" { - *configPath = "conf/npc.conf" + *configPath = common.GetConfigPath() } go client.StartFromFile(*configPath) } diff --git a/lib/common/run.go b/lib/common/run.go index 569ff5c..e124915 100644 --- a/lib/common/run.go +++ b/lib/common/run.go @@ -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 +}