Fix RemoveAll() and MkdirAll() functions

master
Arsen Musayelyan 4 months ago
parent 3e9957d419
commit b476853dc0

@ -38,12 +38,19 @@ func (blefs *FS) removeAllChildren(path string) error {
}
for _, entry := range list {
name := entry.Name()
if name == "." || name == ".." {
continue
}
entryPath := filepath.Join(path, name)
if entry.IsDir() {
err = blefs.removeAllChildren(filepath.Join(path, entry.Name()))
err = blefs.removeAllChildren(entryPath)
} else {
err = blefs.Remove(path)
err = blefs.Remove(entryPath)
}
if err != nil {
if err != nil && err.(FSError).Code != -2 {
return err
}
}
@ -58,7 +65,7 @@ func (blefs *FS) MkdirAll(path string) error {
splitPath := strings.Split(path, "/")
for i := 1; i < len(splitPath); i++ {
curPath := strings.Join(splitPath[0:i], "/")
curPath := strings.Join(splitPath[0:i+1], "/")
err := blefs.Mkdir(curPath)
if err != nil && err.(FSError).Code != -17 {

Loading…
Cancel
Save