INNER CODE UNIT · Go
defaultStateDirectory
genuinetools/img · main.go:144
func defaultStateDirectory() string {
// pam_systemd sets XDG_RUNTIME_DIR but not other dirs.
xdgDataHome := os.Getenv("XDG_DATA_HOME")
if xdgDataHome != "" {
dirs := strings.Split(xdgDataHome, ":")
return filepath.Join(dirs[0], "img")
}
home := os.Getenv("HOME")
if home != "" {
return filepath.Join(home, ".local", "share", "img")
}
return "/tmp/img"
}