26 lines
529 B
Go
26 lines
529 B
Go
|
//go:build windows
|
||
|
// +build windows
|
||
|
|
||
|
package util
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"path/filepath"
|
||
|
)
|
||
|
|
||
|
// IsSuperUser returns true, if the current user is a super user
|
||
|
// A.K.A root, Administrator etc
|
||
|
func IsSuperUser() bool {
|
||
|
_, err := os.Open("\\\\.\\PHYSICALDRIVE0")
|
||
|
if err != nil {
|
||
|
return false
|
||
|
}
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
// GetGlobalConfigurationDirectory returns OS specific location for putting
|
||
|
// global configuration files
|
||
|
func GetGlobalConfigurationDirectory(appname string) string {
|
||
|
return filepath.Join(os.Getenv("APPDATA"), appname)
|
||
|
}
|