summaryrefslogtreecommitdiffstats
path: root/src/file.rs
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2015-05-07 22:27:33 +0100
committerBen S <ogham@bsago.me>2015-05-07 22:27:33 +0100
commitb4529671b8cc2a975c01d6aedf647184a253071d (patch)
tree54d30ca1b34bfbcc8ae44e59be4f74242a33930a /src/file.rs
parent9d1aadc808e9de615692ef993154025da1c6a26a (diff)
Highlight executable files in green
This was intended from the start, but the dead_code checker was dulled by the module being public!
Diffstat (limited to 'src/file.rs')
-rw-r--r--src/file.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/file.rs b/src/file.rs
index 48f5366..4069a73 100644
--- a/src/file.rs
+++ b/src/file.rs
@@ -94,6 +94,11 @@ impl<'a> File<'a> {
self.stat.is_file()
}
+ pub fn is_executable_file(&self) -> bool {
+ let bit = unix::fs::USER_EXECUTE;
+ self.is_file() && (self.stat.permissions().mode() & bit) == bit
+ }
+
pub fn is_link(&self) -> bool {
self.stat.file_type().is_symlink()
}