Store ethash datafiles in a separate directory. (#949)

This commit is contained in:
Igor Mandrigin 2020-08-20 16:59:06 +02:00 committed by GitHub
parent 01f211f3b8
commit fbcf48f29d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,16 +86,19 @@ func init() {
}
}
if runtime.GOOS == "darwin" {
DefaultConfig.Ethash.DatasetDir = filepath.Join(home, "Library", "Ethash")
DefaultConfig.Ethash.DatasetDir = filepath.Join(home, "Library", "tg-ethash")
} else if runtime.GOOS == "windows" {
localappdata := os.Getenv("LOCALAPPDATA")
if localappdata != "" {
DefaultConfig.Ethash.DatasetDir = filepath.Join(localappdata, "Ethash")
DefaultConfig.Ethash.DatasetDir = filepath.Join(localappdata, "tg-thash")
} else {
DefaultConfig.Ethash.DatasetDir = filepath.Join(home, "AppData", "Local", "Ethash")
DefaultConfig.Ethash.DatasetDir = filepath.Join(home, "AppData", "Local", "tg-ethash")
}
} else {
DefaultConfig.Ethash.DatasetDir = filepath.Join(home, ".ethash")
if xdgDataDir := os.Getenv("XDG_DATA_HOME"); xdgDataDir != "" {
DefaultConfig.Ethash.DatasetDir = filepath.Join(xdgDataDir, "tg-ethash")
}
DefaultConfig.Ethash.DatasetDir = filepath.Join(home, ".local/share/tg-ethash")
}
}