diff options
author | Ben S <ogham@bsago.me> | 2015-05-07 22:27:33 +0100 |
---|---|---|
committer | Ben S <ogham@bsago.me> | 2015-05-07 22:27:33 +0100 |
commit | b4529671b8cc2a975c01d6aedf647184a253071d (patch) | |
tree | 54d30ca1b34bfbcc8ae44e59be4f74242a33930a /src/file.rs | |
parent | 9d1aadc808e9de615692ef993154025da1c6a26a (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.rs | 5 |
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() } |