feature: moved file perm source files into files package

master
amorozov 2024-06-30 00:58:10 +03:00
parent 67d71f2eef
commit 6215b4e87f
3 changed files with 4 additions and 8 deletions

View File

@ -1,16 +1,14 @@
package file_perm package files
import ( import (
"os" "os"
"git.tswf.io/incredible-go/incredible-go-core/pkg/io/files"
) )
func GetPermForDir(dirLocation string) os.FileMode { func GetPermForDir(dirLocation string) os.FileMode {
userHome, err := os.UserHomeDir() userHome, err := os.UserHomeDir()
if err == nil { if err == nil {
if files.IsFileLocatedIn(dirLocation, userHome) { if IsFileLocatedIn(dirLocation, userHome) {
return DirUserPermitted return DirUserPermitted
} }
} }

View File

@ -2,11 +2,9 @@ package files
import ( import (
"os" "os"
"git.tswf.io/incredible-go/incredible-go-core/pkg/io/files/file_perm"
) )
func MkdirsAutoPerm(dirLocation string) error { func MkdirsAutoPerm(dirLocation string) error {
perm := file_perm.GetPermForDir(dirLocation) perm := GetPermForDir(dirLocation)
return os.MkdirAll(dirLocation, perm) return os.MkdirAll(dirLocation, perm)
} }

View File

@ -1,4 +1,4 @@
package file_perm package files
import "os" import "os"