aboutsummaryrefslogtreecommitdiff
path: root/filesystem/path.go
diff options
context:
space:
mode:
Diffstat (limited to 'filesystem/path.go')
-rw-r--r--filesystem/path.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/filesystem/path.go b/filesystem/path.go
index b9b403d..274dc0a 100644
--- a/filesystem/path.go
+++ b/filesystem/path.go
@@ -78,6 +78,12 @@ func isRegularFile(path string) bool {
return err == nil && info.Mode().IsRegular()
}
+// HaveReadAccessTo returns true if the process has read access to a file or
+// directory, without actually opening it.
+func HaveReadAccessTo(path string) bool {
+ return unix.Access(path, unix.R_OK) == nil
+}
+
// DeviceNumber represents a combined major:minor device number.
type DeviceNumber uint64