From b5365fb005f6f4d7209236304a65ebfbd454cd0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=90=89=E6=89=8D?= Date: Thu, 22 Oct 2020 22:49:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=A0=B9=E7=9B=AE=E5=BD=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gPath/path.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gPath/path.go b/gPath/path.go index 91d1d0c..da3832d 100644 --- a/gPath/path.go +++ b/gPath/path.go @@ -15,7 +15,13 @@ func Current() string { if err != nil { log.Fatal(err) } - return strings.Replace(dir, "\\", "/", -1) //将\替换成/ + + dirStr := strings.Replace(dir, "\\", "/", -1) //将\替换成/ + + if dirStr == "/" { + return "" + } + return dirStr } func CurrentFile(s string) string {