linstrom/shared/isWritable_windows.go
mstar 98191fd098
Some checks are pending
/ test (push) Waiting to run
Add proper logfile support
2025-04-08 17:29:28 +02:00

23 lines
407 B
Go

package shared
import "os"
// Copied from https://stackoverflow.com/a/20026945 and https://stackoverflow.com/a/49148866
func IsWritable(path string) bool {
info, err := os.Stat(path)
if err != nil {
return false
}
err = nil
if !info.IsDir() {
return false
}
// Check if the user bit is enabled in file permission
if info.Mode().Perm()&(1<<(uint(7))) == 0 {
return false
}
return true
}