Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't ignore hidden files in du example #32

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions examples/du.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
extern crate jwalk;

use jwalk::{WalkDirGeneric};
use jwalk::WalkDirGeneric;
use std::env;

fn main() {
let path = env::args().skip(1).next().unwrap_or("./".to_owned());
let mut total: u64 = 0;

for dir_entry_result in WalkDirGeneric::<((), Option<u64>)>::new(&path).process_read_dir(
|_, _, _, dir_entry_results| {
for dir_entry_result in WalkDirGeneric::<((), Option<u64>)>::new(&path)
.skip_hidden(false)
.process_read_dir(|_, _, _, dir_entry_results| {
dir_entry_results.iter_mut().for_each(|dir_entry_result| {
if let Ok(dir_entry) = dir_entry_result {
if !dir_entry.file_type.is_dir() {
Expand All @@ -17,8 +18,8 @@ fn main() {
}
}
})
},
) {
})
{
match dir_entry_result {
Ok(dir_entry) => {
if let Some(len) = &dir_entry.client_state {
Expand Down