Skip to content

Commit b1360ea

Browse files
author
yggverse
committed
fix hidden directory entries count on show_hidden option is disabled
1 parent 96c8a82 commit b1360ea

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/session/public.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,14 @@ impl Public {
152152
(true, _) => dirs.push(Dir {
153153
meta,
154154
name,
155-
count: fs::read_dir(e.path()).map_or(0, |i| i.count()),
155+
count: fs::read_dir(e.path()).map_or(0, |i| {
156+
i.filter_map(Result::ok)
157+
.filter(|e| {
158+
self.show_hidden
159+
|| !e.file_name().to_string_lossy().starts_with('.')
160+
})
161+
.count()
162+
}),
156163
}),
157164
(_, true) => files.push(File { meta, name }),
158165
_ => continue, // @TODO symlinks support?

0 commit comments

Comments
 (0)