feat: Implement MkdirAll

This commit is contained in:
Felicitas Pojtinger
2021-12-21 22:04:35 +01:00
parent 923702f202
commit ac50d61f0c

View File

@@ -139,7 +139,22 @@ func (f *FileSystem) Mkdir(name string, perm os.FileMode) error {
func (f *FileSystem) MkdirAll(path string, perm os.FileMode) error {
log.Println("FileSystem.MkdirAll", path, perm)
panic(ErrNotImplemented)
parts := filepath.SplitList(path)
currentPath := ""
for _, part := range parts {
if currentPath == "" {
currentPath = part
} else {
currentPath = filepath.Join(currentPath, part)
}
if err := f.Mkdir(currentPath, perm); err != nil {
return err
}
}
return nil
}
func (f *FileSystem) Open(name string) (afero.File, error) {