aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorHackyMiner <hackyminer@gmail.com>2019-02-19 19:15:15 +0800
committerFelix Lange <fjl@users.noreply.github.com>2019-02-19 19:15:15 +0800
commitf7f6a46029c23d2c1b5a5293d470becbdb4e3366 (patch)
treebfe3e6fa048e8bdc0d16357156909e079fc24413 /eth
parentd2256244c4f6dbb7312fa280b5523c544d8c10af (diff)
downloadgo-tangerine-f7f6a46029c23d2c1b5a5293d470becbdb4e3366.tar
go-tangerine-f7f6a46029c23d2c1b5a5293d470becbdb4e3366.tar.gz
go-tangerine-f7f6a46029c23d2c1b5a5293d470becbdb4e3366.tar.bz2
go-tangerine-f7f6a46029c23d2c1b5a5293d470becbdb4e3366.tar.lz
go-tangerine-f7f6a46029c23d2c1b5a5293d470becbdb4e3366.tar.xz
go-tangerine-f7f6a46029c23d2c1b5a5293d470becbdb4e3366.tar.zst
go-tangerine-f7f6a46029c23d2c1b5a5293d470becbdb4e3366.zip
eth, node: use APPDATA env to support cygwin/msys correctly (#17786)
This changes default location of the data directory to use the LOCALAPPDATA environment variable, resolving issues with remote home directories an improving compatibility with Cygwin. Fixes #2239 Fixes #2237 Fixes #16437
Diffstat (limited to 'eth')
-rw-r--r--eth/config.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/eth/config.go b/eth/config.go
index f71b8dfee..aca9b5e68 100644
--- a/eth/config.go
+++ b/eth/config.go
@@ -68,8 +68,15 @@ func init() {
home = user.HomeDir
}
}
- if runtime.GOOS == "windows" {
- DefaultConfig.Ethash.DatasetDir = filepath.Join(home, "AppData", "Ethash")
+ if runtime.GOOS == "darwin" {
+ DefaultConfig.Ethash.DatasetDir = filepath.Join(home, "Library", "Ethash")
+ } else if runtime.GOOS == "windows" {
+ localappdata := os.Getenv("LOCALAPPDATA")
+ if localappdata != "" {
+ DefaultConfig.Ethash.DatasetDir = filepath.Join(localappdata, "Ethash")
+ } else {
+ DefaultConfig.Ethash.DatasetDir = filepath.Join(home, "AppData", "Local", "Ethash")
+ }
} else {
DefaultConfig.Ethash.DatasetDir = filepath.Join(home, ".ethash")
}