From e7bb3468d3e32f79b4a40e63040c344abc1f9062 Mon Sep 17 00:00:00 2001 From: hackyminer Date: Sun, 21 Oct 2018 19:31:18 +0900 Subject: [PATCH] eth: use LOCALAPPDATA env variable for the Ethash cache dir. --- eth/config.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/eth/config.go b/eth/config.go index efbaafb6a2..de7558a0de 100644 --- a/eth/config.go +++ b/eth/config.go @@ -67,8 +67,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") }