From d43cbde1f6f73f1c5ac821131d418c471e5d2d5b Mon Sep 17 00:00:00 2001 From: xiexiao Date: Sat, 22 Aug 2020 13:14:34 +0800 Subject: [PATCH] =?UTF-8?q?Windows=E6=9C=8D=E5=8A=A1=E8=BF=90=E8=A1=8Cnpc?= =?UTF-8?q?=E6=97=B6=E8=AF=BB=E5=8F=96=E7=A8=8B=E5=BA=8F=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B=E7=9A=84config=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/npc/npc.go | 2 +- lib/common/run.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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 +}