From c47b7a57aaabf62047bad3f7ad69ddb200c38400 Mon Sep 17 00:00:00 2001 From: Tarek Date: Tue, 6 Aug 2024 18:34:56 +0300 Subject: [PATCH] random bullshit go Signed-off-by: Tarek --- fs-index/src/utils.rs | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/fs-index/src/utils.rs b/fs-index/src/utils.rs index 5ee573ab..859ad788 100644 --- a/fs-index/src/utils.rs +++ b/fs-index/src/utils.rs @@ -93,10 +93,7 @@ pub(crate) fn discover_paths>( println!("WalkDir Entry: {:?}", entry.path()); } - let walker = WalkDir::new(&root_path) - .min_depth(1) // Skip the root directory - .into_iter() - .filter_entry(should_index); // Skip hidden files and empty files + let walker = WalkDir::new(&root_path).into_iter(); // Filter out directories let paths = walker @@ -106,7 +103,7 @@ pub(crate) fn discover_paths>( println!("\t\tEntry: {:?}", entry.path()); // print entry type println!("\t\t\tEntry Type: {:?}", entry.file_type()); - if !entry.file_type().is_dir() { + if entry.file_type().is_file() { Some(entry) } else { None @@ -157,23 +154,23 @@ pub(crate) fn scan_entry(entry: DirEntry) -> Timestamped { /// A helper function to check if the entry should be indexed (not hidden or /// empty) fn should_index(entry: &walkdir::DirEntry) -> bool { - // Check if the entry is hidden - if entry - .file_name() - .to_string_lossy() - .starts_with('.') - { - return false; - } - - // Check if the entry is empty - if entry - .metadata() - .map(|m| m.len() == 0) - .unwrap_or(false) - { - return false; - } + // // Check if the entry is hidden + // if entry + // .file_name() + // .to_string_lossy() + // .starts_with('.') + // { + // return false; + // } + + // // Check if the entry is empty + // if entry + // .metadata() + // .map(|m| m.len() == 0) + // .unwrap_or(false) + // { + // return false; + // } true }