Skip to content

Commit

Permalink
should index
Browse files Browse the repository at this point in the history
Signed-off-by: Tarek <[email protected]>
  • Loading branch information
tareknaser committed Aug 6, 2024
1 parent bb9d142 commit 580902d
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions fs-index/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ pub(crate) fn discover_paths<P: AsRef<Path>>(
) -> Result<Vec<DirEntry>> {
log::debug!("Discovering paths at root path: {:?}", root_path.as_ref());

// Print files in the root directory
for entry in WalkDir::new(&root_path) {
let entry = entry.unwrap();
println!("WalkDir Entry: {:?}", entry.path());
// type
println!("\t\tFile type: {:?}", entry.file_type());
}

// Same but min_depth(1) to skip the root directory
for entry in WalkDir::new(&root_path).min_depth(1) {
let entry = entry.unwrap();
Expand All @@ -95,12 +87,17 @@ pub(crate) fn discover_paths<P: AsRef<Path>>(
}

// same but filter_entry(should_index) to skip hidden files
for entry in WalkDir::new(&root_path)
.min_depth(1)
.into_iter()
.filter_entry(should_index)
{
for entry in WalkDir::new(&root_path).min_depth(1).into_iter() {
let entry = entry.unwrap();
// Ignore entries that don't pass the should_index filter
if !should_index(&entry) {
println!(
"WalkDir Entry (filter_entry(should_index)): {:?}",
entry.path()
);
continue;
}

println!(
"WalkDir Entry (filter_entry(should_index)): {:?}",
entry.path()
Expand Down

0 comments on commit 580902d

Please sign in to comment.