cmd, node: use APPDATA env if it available

This commit is contained in:
hackyminer 2018-10-21 19:06:58 +09:00
parent 6b9f68f060
commit c5549ae256
No known key found for this signature in database
GPG key ID: 46D453DDCA4B766F
2 changed files with 12 additions and 2 deletions

View file

@ -494,7 +494,12 @@ func DefaultConfigDir() string {
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" {
return filepath.Join(home, "Library", "Signer") return filepath.Join(home, "Library", "Signer")
} else if runtime.GOOS == "windows" { } 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 { } else {
return filepath.Join(home, ".clef") return filepath.Join(home, ".clef")
} }

View file

@ -59,7 +59,12 @@ func DefaultDataDir() string {
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" {
return filepath.Join(home, "Library", "Ethereum") return filepath.Join(home, "Library", "Ethereum")
} else if runtime.GOOS == "windows" { } 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 { } else {
return filepath.Join(home, ".ethereum") return filepath.Join(home, ".ethereum")
} }