feature: moved file perm source files into files package
parent
67d71f2eef
commit
6215b4e87f
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package file_perm
|
package files
|
||||||
|
|
||||||
import "os"
|
import "os"
|
||||||
|
|
Loading…
Reference in New Issue