Skip to content

Commit

Permalink
Highlight executable files in green
Browse files Browse the repository at this point in the history
This was intended from the start, but the dead_code checker was dulled by the module being public!
  • Loading branch information
ogham committed May 7, 2015
1 parent 9d1aadc commit b452967
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
3 changes: 3 additions & 0 deletions src/filetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ impl<'a> HasType for File<'a> {
if self.is_directory() {
return Directory;
}
else if self.is_executable_file() {
return Executable;
}
else if self.is_link() {
return Symlink;
}
Expand Down

0 comments on commit b452967

Please sign in to comment.