all: use common.FileExist for checking file existence (#24748)

This commit is contained in:
s7v7nislands
2022-04-27 11:48:02 +02:00
committed by GitHub
parent c3a5054c27
commit 5a584c2133
5 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -18,11 +18,11 @@ package main
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/console"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
@@ -130,7 +130,7 @@ func remoteConsole(ctx *cli.Context) error {
// 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) {
if common.FileExist(legacyPath) {
path = legacyPath
} else {
path = filepath.Join(path, "ropsten")