This was intended from the start, but the dead_code checker was dulled by the module being public!
@@ -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()
@@ -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;