feature: unix directory permission improvements
This commit is contained in:
19
pkg/io/files/file_perm/auto_file_perm.go
Normal file
19
pkg/io/files/file_perm/auto_file_perm.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package file_perm
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"git.tswf.io/incredible-go/incredible-go-core/pkg/io/files"
|
||||
)
|
||||
|
||||
func GetPermForDir(dirLocation string) os.FileMode {
|
||||
userHome, err := os.UserHomeDir()
|
||||
|
||||
if err == nil {
|
||||
if files.IsFileLocatedIn(dirLocation, userHome) {
|
||||
return DirUserPermitted
|
||||
}
|
||||
}
|
||||
|
||||
return DirAllPermitted
|
||||
}
|
||||
8
pkg/io/files/file_perm/file_perm.go
Normal file
8
pkg/io/files/file_perm/file_perm.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package file_perm
|
||||
|
||||
import "os"
|
||||
|
||||
const (
|
||||
DirUserPermitted os.FileMode = 0755
|
||||
DirAllPermitted = os.ModePerm
|
||||
)
|
||||
Reference in New Issue
Block a user