From e140e725ab9c248d7e74aed4033c328290353d11 Mon Sep 17 00:00:00 2001 From: zhangxin Date: Fri, 19 Mar 2021 17:23:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0GetCurrentPath=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/file.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/utils/file.go b/utils/file.go index 5dbed3c..a36904f 100644 --- a/utils/file.go +++ b/utils/file.go @@ -99,7 +99,24 @@ func IsExists(path string) bool { } -//windows环境下获取绝对路径 +/****************************************************************************** + * + * @Function Name : GetCurrentPath + *----------------------------------------------------------------------------- + * + * @Description : windows下获取传入相对路径的绝对路径 + * + * @Function Parameters : dir 相对路径 + * + * @Return Value : string 绝对路径 + * + * @Return Value : error 执行出现的错误 + * + * @Author : zhangxin + * + * @Date : 2021-03-19 + * + ******************************************************************************/ func GetCurrentPath(dir string) (string, error) { file, err := exec.LookPath(os.Args[0]) if err != nil {