the great refactor

This commit is contained in:
2026-03-04 22:50:37 +01:00
parent b6efa0a818
commit c81178567a
15 changed files with 519 additions and 448 deletions

View File

@@ -4,6 +4,8 @@ use std::{
path::{Path, PathBuf},
};
use walkdir::WalkDir;
pub fn path_to_lowercase(path: impl AsRef<Path>) -> PathBuf {
PathBuf::from(path.as_ref().to_string_lossy().to_lowercase())
}
@@ -40,3 +42,17 @@ pub fn resolve_case_insensitive(
Ok(Some(current))
}
/// Use walkdir to walk all actual files in a dir
/// Returns early id any error occurs
pub fn walk_all_files(
path: impl AsRef<Path>,
) -> Result<impl Iterator<Item = walkdir::DirEntry>, walkdir::Error> {
let a = WalkDir::new(path)
.into_iter()
.collect::<Result<Vec<_>, walkdir::Error>>()?
.into_iter()
.filter(|entry| entry.file_type().is_file());
Ok(a)
}