From 0786bebf3962e862c56577da389d9b14dfb3b5f1 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 2 Jun 2021 10:25:28 +0800 Subject: [PATCH] Don't ignore hidden files in `du` example This makes it more realistic as the `du` program itself also doesn't skip hidden files. --- examples/du.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/du.rs b/examples/du.rs index 27060ff..9ac8479 100644 --- a/examples/du.rs +++ b/examples/du.rs @@ -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)>::new(&path).process_read_dir( - |_, _, _, dir_entry_results| { + for dir_entry_result in WalkDirGeneric::<((), Option)>::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() { @@ -17,8 +18,8 @@ fn main() { } } }) - }, - ) { + }) + { match dir_entry_result { Ok(dir_entry) => { if let Some(len) = &dir_entry.client_state {