mirror of
https://github.com/restic/restic.git
synced 2025-08-12 08:27:40 +00:00
fs: Add IsRegularFile()
This commit is contained in:
13
internal/fs/helpers.go
Normal file
13
internal/fs/helpers.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package fs
|
||||||
|
|
||||||
|
import "os"
|
||||||
|
|
||||||
|
// IsRegularFile returns true if fi belongs to a normal file. If fi is nil,
|
||||||
|
// false is returned.
|
||||||
|
func IsRegularFile(fi os.FileInfo) bool {
|
||||||
|
if fi == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return fi.Mode()&(os.ModeType|os.ModeCharDevice) == 0
|
||||||
|
}
|
Reference in New Issue
Block a user