mirror of
https://github.com/safing/portmaster
synced 2025-04-07 20:49:10 +00:00
20 lines
576 B
Go
20 lines
576 B
Go
//go:build !windows
|
|
|
|
package utils
|
|
|
|
import "os"
|
|
|
|
// SetDirPermission sets the permission of a directory.
|
|
func SetDirPermission(path string, perm FSPermission) error {
|
|
return os.Chmod(path, perm.AsUnixDirExecPermission())
|
|
}
|
|
|
|
// SetExecPermission sets the permission of an executable file.
|
|
func SetExecPermission(path string, perm FSPermission) error {
|
|
return SetDirPermission(path, perm)
|
|
}
|
|
|
|
// SetFilePermission sets the permission of a non executable file.
|
|
func SetFilePermission(path string, perm FSPermission) error {
|
|
return os.Chmod(path, perm.AsUnixFilePermission())
|
|
}
|