util/os_windows.go

26 lines
529 B
Go
Raw Normal View History

2022-03-17 10:11:17 +00:00
//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)
}