16 lines
521 B
Go
16 lines
521 B
Go
//go:build windows
|
|||
|
|
|
||
|
|
package client
|
||
|
|
|
||
|
|
import "golang.org/x/sys/windows"
|
||
|
|
|
||
|
|
// programDataDir resolves the ProgramData known folder through the shell
|
||
|
|
// API instead of the ProgramData environment variable: the variable is
|
||
|
|
// user-controlled, and the admin config pins labels — a user must not be
|
||
|
|
// able to point the admin lookup at a folder of their own.
|
||
|
|
func programDataDir() string {
|
||
|
|
if p, err := windows.KnownFolderPath(windows.FOLDERID_ProgramData, 0); err == nil && p != "" {
|
||
|
|
return p
|
||
|
|
}
|
||
|
|
return `C:\ProgramData`
|
||
|
|
}
|