mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 13:21:37 +00:00
parent
b3d12e4fda
commit
75f147a362
1 changed files with 3 additions and 5 deletions
|
|
@ -17,6 +17,8 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
|
@ -24,11 +26,7 @@ import (
|
|||
// FileExist checks if a file exists at filePath.
|
||||
func FileExist(filePath string) bool {
|
||||
_, err := os.Stat(filePath)
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
return !errors.Is(err, fs.ErrNotExist)
|
||||
}
|
||||
|
||||
// AbsolutePath returns datadir + filename, or filename if it is absolute.
|
||||
|
|
|
|||
Loading…
Reference in a new issue