mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/utils: makedatadir should check for existing testnet dir
This commit is contained in:
parent
e81738a41b
commit
5e0f03aacf
1 changed files with 6 additions and 0 deletions
|
|
@ -781,6 +781,12 @@ var (
|
||||||
func MakeDataDir(ctx *cli.Context) string {
|
func MakeDataDir(ctx *cli.Context) string {
|
||||||
if path := ctx.GlobalString(DataDirFlag.Name); path != "" {
|
if path := ctx.GlobalString(DataDirFlag.Name); path != "" {
|
||||||
if ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name) {
|
if ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name) {
|
||||||
|
// Maintain compatibility with older Geth configurations storing the
|
||||||
|
// Ropsten database in `testnet` instead of `ropsten`.
|
||||||
|
legacyPath := filepath.Join(path, "testnet")
|
||||||
|
if _, err := os.Stat(legacyPath); !os.IsNotExist(err) {
|
||||||
|
return legacyPath
|
||||||
|
}
|
||||||
return filepath.Join(path, "ropsten")
|
return filepath.Join(path, "ropsten")
|
||||||
}
|
}
|
||||||
if ctx.GlobalBool(RinkebyFlag.Name) {
|
if ctx.GlobalBool(RinkebyFlag.Name) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue