mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
Change the default datastore dir (#791)
This commit is contained in:
commit
a84eafd235
@ -17,10 +17,12 @@
|
|||||||
package node
|
package node
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/ledgerwatch/turbo-geth/p2p"
|
"github.com/ledgerwatch/turbo-geth/p2p"
|
||||||
"github.com/ledgerwatch/turbo-geth/p2p/nat"
|
"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
|
// DefaultDataDir is the default data directory to use for the databases and other
|
||||||
// persistence requirements.
|
// persistence requirements.
|
||||||
func DefaultDataDir() string {
|
func DefaultDataDir() string {
|
||||||
@ -62,19 +66,19 @@ func DefaultDataDir() string {
|
|||||||
if home != "" {
|
if home != "" {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "darwin":
|
case "darwin":
|
||||||
return filepath.Join(home, "Library", "Ethereum")
|
return filepath.Join(home, "Library", dirname)
|
||||||
case "windows":
|
case "windows":
|
||||||
// We used to put everything in %HOME%\AppData\Roaming, but this caused
|
// We used to put everything in %HOME%\AppData\Roaming, but this caused
|
||||||
// problems with non-typical setups. If this fallback location exists and
|
// problems with non-typical setups. If this fallback location exists and
|
||||||
// is non-empty, use it, otherwise DTRT and check %LOCALAPPDATA%.
|
// 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()
|
appdata := windowsAppData()
|
||||||
if appdata == "" || isNonEmptyDir(fallback) {
|
if appdata == "" || isNonEmptyDir(fallback) {
|
||||||
return fallback
|
return fallback
|
||||||
}
|
}
|
||||||
return filepath.Join(appdata, "Ethereum")
|
return filepath.Join(appdata, dirname)
|
||||||
default:
|
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
|
// As we cannot guess a stable location, return empty and handle later
|
||||||
|
Loading…
Reference in New Issue
Block a user