summaryrefslogtreecommitdiff
path: root/pkg/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/utils.go')
-rw-r--r--pkg/utils.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/pkg/utils.go b/pkg/utils.go
index c3301f2..3920737 100644
--- a/pkg/utils.go
+++ b/pkg/utils.go
@@ -28,15 +28,19 @@ func FilterSlice[T any](slice *[]T, predicate func(T) bool) {
func makeDirectoriesHierarchy(dir string, perms *Permissions) (Status, error) {
if _, err := os.Lstat(dir); err != nil {
if errors.Is(err, fs.ErrNotExist) {
- if status, err := makeDirectoriesHierarchy(filepath.Dir(dir), perms); err != nil {
- return status, err
+ if _, err = makeDirectoriesHierarchy(filepath.Dir(dir), perms); err != nil {
+ return BROKEN, err
+ }
+ var m int
+ if m, err = perms.mode.Int(); err != nil {
+ return BROKEN, err
+ }
+ if err = os.Mkdir(dir, fs.FileMode(m)); err != nil {
+ return BROKEN, err
}
- m, err := perms.mode.Int()
- if err != nil {
+ if _, err = perms.resolve(dir); err != nil {
return BROKEN, err
}
- os.Mkdir(dir, fs.FileMode(m))
- perms.resolve(dir)
return REPAIRED, nil
} else {
return BROKEN, err