Skip to content

Commit ca305a8

Browse files
author
Aaron Lamb
committed
feat: Adds filtering for Windows hidden files
Adds an extra check on attributes().hidden on Windows This hides Windows hidden files whenever dot files are also filtered out Resolves eza-community#212
1 parent 5c75b0e commit ca305a8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/fs/dir.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,17 @@ impl<'dir, 'ig> Files<'dir, 'ig> {
130130
}
131131
}
132132

133-
return Some(File::from_args(path.clone(), self.dir, filename, self.deref_links)
134-
.map_err(|e| (path.clone(), e)))
133+
let file = File::from_args(path.clone(), self.dir, filename, self.deref_links)
134+
.map_err(|e| (path.clone(), e));
135+
136+
// Windows has its own concept of hidden files, when dotfiles are
137+
// hidden Windows hidden files should also be filtered out
138+
#[cfg(windows)]
139+
if !self.dotfiles && file.as_ref().is_ok_and(|f| f.attributes().hidden) {
140+
continue;
141+
}
142+
143+
return Some(file);
135144
}
136145

137146
return None

0 commit comments

Comments
 (0)