Commit dd28ba37 authored by Felix Lange's avatar Felix Lange Committed by Péter Szilágyi

node: require LocalAppData variable (#19132)

* node: require LocalAppData variable

This avoids path inconsistencies on Windows XP.
Hat tip to @MicahZoltu for catching this so quickly.

* node: fix typo
parent 62d9d638
...@@ -80,13 +80,14 @@ func DefaultDataDir() string { ...@@ -80,13 +80,14 @@ func DefaultDataDir() string {
} }
func windowsAppData() string { func windowsAppData() string {
if v := os.Getenv("LOCALAPPDATA"); v != "" { v := os.Getenv("LOCALAPPDATA")
return v // Vista+ if v == "" {
// Windows XP and below don't have LocalAppData. Crash here because
// we don't support Windows XP and undefining the variable will cause
// other issues.
panic("environment variable LocalAppData is undefined")
} }
if v := os.Getenv("APPDATA"); v != "" { return v
return filepath.Join(v, "Local")
}
return ""
} }
func isNonEmptyDir(dir string) bool { func isNonEmptyDir(dir string) bool {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment