aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2019-02-28 19:11:52 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-02-28 19:11:52 +0800
commitdd28ba378a8138f95c1c261972894afafa4031c3 (patch)
tree5aebe212feb1bd7c094825d91a6f84423e42c41f
parent62d9d638582fa5fd7bcfaa55e8810fcfb898a4dd (diff)
downloadgo-tangerine-dd28ba378a8138f95c1c261972894afafa4031c3.tar
go-tangerine-dd28ba378a8138f95c1c261972894afafa4031c3.tar.gz
go-tangerine-dd28ba378a8138f95c1c261972894afafa4031c3.tar.bz2
go-tangerine-dd28ba378a8138f95c1c261972894afafa4031c3.tar.lz
go-tangerine-dd28ba378a8138f95c1c261972894afafa4031c3.tar.xz
go-tangerine-dd28ba378a8138f95c1c261972894afafa4031c3.tar.zst
go-tangerine-dd28ba378a8138f95c1c261972894afafa4031c3.zip
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
-rw-r--r--node/defaults.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/node/defaults.go b/node/defaults.go
index 73b262429..71e763346 100644
--- a/node/defaults.go
+++ b/node/defaults.go
@@ -80,13 +80,14 @@ func DefaultDataDir() string {
}
func windowsAppData() string {
- if v := os.Getenv("LOCALAPPDATA"); v != "" {
- return v // Vista+
+ v := os.Getenv("LOCALAPPDATA")
+ 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 filepath.Join(v, "Local")
- }
- return ""
+ return v
}
func isNonEmptyDir(dir string) bool {