From 278630fca64d1d0711658ae08b6230ad1afddefe Mon Sep 17 00:00:00 2001 From: Igor Mandrigin Date: Mon, 27 Jul 2020 11:47:28 +0200 Subject: [PATCH] Change the default datastore dir --- node/defaults.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/node/defaults.go b/node/defaults.go index 7e5ed02ce..584428b2b 100644 --- a/node/defaults.go +++ b/node/defaults.go @@ -17,10 +17,12 @@ package node import ( + "fmt" "os" "os/user" "path/filepath" "runtime" + "strings" "github.com/ledgerwatch/turbo-geth/p2p" "github.com/ledgerwatch/turbo-geth/p2p/nat" @@ -54,6 +56,8 @@ var DefaultConfig = Config{ }, } +const dirname = "TurboGeth" + // DefaultDataDir is the default data directory to use for the databases and other // persistence requirements. func DefaultDataDir() string { @@ -62,19 +66,19 @@ func DefaultDataDir() string { if home != "" { switch runtime.GOOS { case "darwin": - return filepath.Join(home, "Library", "Ethereum") + return filepath.Join(home, "Library", dirname) case "windows": // We used to put everything in %HOME%\AppData\Roaming, but this caused // problems with non-typical setups. If this fallback location exists and // is non-empty, use it, otherwise DTRT and check %LOCALAPPDATA%. - fallback := filepath.Join(home, "AppData", "Roaming", "Ethereum") + fallback := filepath.Join(home, "AppData", "Roaming", dirname) appdata := windowsAppData() if appdata == "" || isNonEmptyDir(fallback) { return fallback } - return filepath.Join(appdata, "Ethereum") + return filepath.Join(appdata, dirname) default: - return filepath.Join(home, ".ethereum") + return filepath.Join(home, fmt.Sprintf(".%s", strings.ToLower(dirname))) } } // As we cannot guess a stable location, return empty and handle later