From c5549ae256605671815be64e2656f0aa46844949 Mon Sep 17 00:00:00 2001 From: hackyminer Date: Sun, 21 Oct 2018 19:06:58 +0900 Subject: [PATCH] cmd, node: use APPDATA env if it available --- cmd/clef/main.go | 7 ++++++- node/defaults.go | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/clef/main.go b/cmd/clef/main.go index c060285be6..b5451a9b4f 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -494,7 +494,12 @@ func DefaultConfigDir() string { if runtime.GOOS == "darwin" { return filepath.Join(home, "Library", "Signer") } else if runtime.GOOS == "windows" { - return filepath.Join(home, "AppData", "Roaming", "Signer") + appdata := os.Getenv("APPDATA") + if appdata != "" { + return filepath.Join(appdata, "Signer") + } else { + return filepath.Join(home, "AppData", "Roaming", "Signer") + } } else { return filepath.Join(home, ".clef") } diff --git a/node/defaults.go b/node/defaults.go index 8e0655848b..350e3dcd8e 100644 --- a/node/defaults.go +++ b/node/defaults.go @@ -59,7 +59,12 @@ func DefaultDataDir() string { if runtime.GOOS == "darwin" { return filepath.Join(home, "Library", "Ethereum") } else if runtime.GOOS == "windows" { - return filepath.Join(os.Getenv("APPDATA"), "Ethereum") + appdata := os.Getenv("APPDATA") + if appdata != "" { + return filepath.Join(appdata, "Ethereum") + } else { + return filepath.Join(home, "AppData", "Roaming", "Ethereum") + } } else { return filepath.Join(home, ".ethereum") }