From 22c72ab811baaa3f5c1a165eb686b33fbfeef5aa Mon Sep 17 00:00:00 2001 From: Granty1 Date: Fri, 12 Jun 2020 16:20:38 +0800 Subject: [PATCH] Add some log & remove useless func --- server/utils/directory.go | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/server/utils/directory.go b/server/utils/directory.go index 39288670..d0e1c781 100644 --- a/server/utils/directory.go +++ b/server/utils/directory.go @@ -1,8 +1,8 @@ package utils import ( + "gin-vue-admin/global" "os" - "path/filepath" ) // @title PathExists @@ -32,33 +32,15 @@ func CreateDir(dirs ...string) (err error) { for _, v := range dirs { exist, err := PathExists(v) if err != nil { - // log.L.Info(fmt.Sprintf("get dir error![%v]\n", err)) return err } - if exist { - // log.L.Info(fmt.Sprintf("has dir![%v]\n"+_dir)) - } else { - // log.L.Info(fmt.Sprintf("no dir![%v]\n"+_dir)) - // 创建文件夹 + if !exist { + global.GVA_LOG.Debug("create directory ", v) err = os.MkdirAll(v, os.ModePerm) if err != nil { - // log.L.Error(fmt.Sprintf("mkdir error![%v]\n",err)) - } else { - // log.L.Info("mkdir success!\n") + global.GVA_LOG.Error("create directory", v, " error:", err) } } } return err } - -// @title cwd -// @description 获取当前工作目录 -// @return string - -func CWD() string { - path, err := os.Executable() - if err != nil { - return "" - } - return filepath.Dir(path) -}