Skip to content

Commit

Permalink
🖇 merge pull :request #12 from go-admin-team/dev
Browse files Browse the repository at this point in the history
fix🐛 : 修复IsNotExistMkDir
  • Loading branch information
wenjianzhang authored Mar 31, 2021
2 parents f63f944 + ea4bd41 commit c31ef04
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sdk/pkg/utils/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ func CheckPermission(src string) bool {
return os.IsPermission(err)
}

// IsNotExistMkDir 如果不存在则新建文件夹
// IsNotExistMkDir 检查文件夹是否存在
// 如果不存在则新建文件夹
func IsNotExistMkDir(src string) error {
if exist := CheckExist(src); exist == false {
if exist := !CheckExist(src); exist == false {
if err := MkDir(src); err != nil {
return err
}
Expand Down Expand Up @@ -124,4 +125,4 @@ func GetType(p string) (string, error) {
//var list = strings.Split(filetype, "/")
//filetype = list[0] + "/" + ext
return filetype, nil
}
}
15 changes: 15 additions & 0 deletions sdk/pkg/utils/file_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package utils

import (
"testing"
)

// TestIsNotExistMkDir 测试IsNotExistMkDir函数
func TestIsNotExistMkDir(t *testing.T) {
err := IsNotExistMkDir("../../pkg/aaa")
if err != nil {
t.Error(err)
} else {
t.Log("done")
}
}

0 comments on commit c31ef04

Please sign in to comment.