diff --git a/build/ci.go b/build/ci.go index f68a45fdc1fa..881c3b5168f9 100644 --- a/build/ci.go +++ b/build/ci.go @@ -49,6 +49,7 @@ import ( "runtime" "strings" + "github.com/XinFinOrg/XDPoSChain/common" "github.com/XinFinOrg/XDPoSChain/internal/build" ) @@ -79,7 +80,7 @@ func executablePath(name string) string { func main() { log.SetFlags(log.Lshortfile) - if _, err := os.Stat(filepath.Join("build", "ci.go")); os.IsNotExist(err) { + if !common.FileExist(filepath.Join("build", "ci.go")) { log.Fatal("this script must be run from the root of the repository") } if len(os.Args) < 2 { diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 4e9336fb30d5..1edfce3df727 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1565,7 +1565,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { } if ctx.IsSet(StoreRewardFlag.Name) { common.StoreRewardFolder = filepath.Join(stack.DataDir(), "XDC", "rewards") - if _, err := os.Stat(common.StoreRewardFolder); os.IsNotExist(err) { + if !common.FileExist(common.StoreRewardFolder) { os.Mkdir(common.StoreRewardFolder, os.ModePerm) } } diff --git a/core/txpool/journal.go b/core/txpool/journal.go index 871807729ce7..88550a56b277 100644 --- a/core/txpool/journal.go +++ b/core/txpool/journal.go @@ -58,7 +58,7 @@ func newTxJournal(path string) *journal { // the specified pool. func (journal *journal) load(add func([]*types.Transaction) []error) error { // Skip the parsing if the journal file doens't exist at all - if _, err := os.Stat(journal.path); os.IsNotExist(err) { + if !common.FileExist(journal.path) { return nil } // Open the journal for loading any past transactions diff --git a/core/txpool/lending_tx_journal.go b/core/txpool/lending_tx_journal.go index fb9b487ac5e5..e56ab70051db 100644 --- a/core/txpool/lending_tx_journal.go +++ b/core/txpool/lending_tx_journal.go @@ -44,7 +44,7 @@ func newLendingTxJournal(path string) *lendingtxJournal { // the specified pool. func (journal *lendingtxJournal) load(add func(*types.LendingTransaction) error) error { // Skip the parsing if the journal file doens't exist at all - if _, err := os.Stat(journal.path); os.IsNotExist(err) { + if !common.FileExist(journal.path) { return nil } // Open the journal for loading any past transactions diff --git a/core/txpool/order_tx_journal.go b/core/txpool/order_tx_journal.go index cbcb49c7b72b..d6689d611a11 100644 --- a/core/txpool/order_tx_journal.go +++ b/core/txpool/order_tx_journal.go @@ -44,7 +44,7 @@ func newOrderTxJournal(path string) *ordertxJournal { // the specified pool. func (journal *ordertxJournal) load(add func(*types.OrderTransaction) error) error { // Skip the parsing if the journal file doens't exist at all - if _, err := os.Stat(journal.path); os.IsNotExist(err) { + if !common.FileExist(journal.path) { return nil } // Open the journal for loading any past transactions