Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions common/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@
package common

import (
"errors"
"io/fs"
"os"
"path/filepath"
)

// 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.
Expand Down