Fix: folder with the same name should not be created

This commit is contained in:
HFO4
2019-11-27 19:14:13 +08:00
parent b3ef833afd
commit 0982347f40
5 changed files with 17 additions and 3 deletions

View File

@ -107,6 +107,12 @@ func (fs *FileSystem) CreateDirectory(ctx context.Context, fullPath string) erro
return ErrPathNotExist
}
// 是否有同名目录
b, _ := fs.IsPathExist(fullPath)
if b {
return ErrFolderExisted
}
// 是否有同名文件
if ok, _ := fs.IsFileExist(path.Join(base, dir)); ok {
return ErrFileExisted