提交 d9fa8620 编写于 作者: 4 4lkaid

fix(utils/directory.go): 同名文件存在时正确返回

上级 400b2e03
package utils
import (
"errors"
"os"
"github.com/flipped-aurora/gin-vue-admin/server/global"
......@@ -14,9 +15,12 @@ import (
//@return: bool, error
func PathExists(path string) (bool, error) {
_, err := os.Stat(path)
fi, err := os.Stat(path)
if err == nil {
return true, nil
if fi.IsDir() {
return true, nil
}
return false, errors.New("存在同名文件")
}
if os.IsNotExist(err) {
return false, nil
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册