gowebframework/is-writable_windows.go

31 lines
529 B
Go

/*
* @Author: Bartuccio Antoine
* @Date: 2018-07-17 18:51:12
* @Last Modified by: klmp200
* @Last Modified time: 2018-07-17 18:54:20
*/
// WARNING : Not tested !
package gowebframework
import (
"os"
)
func isWritable(path string) bool {
stats, err := os.Stat(path)
if err != nil {
// Folder or file doesn't exist
return false
}
if stats.Mode().Perm()&(1<<(uint(7))) == 0 {
// Check if the user bit is enabled in file permission
// It's the only thing we can do on windows
return false
}
return true
}