Expand description
Shared bounded directory walkers.
Replaces the per-plugin collect_*_files helpers that previously
lived in nearly every module. Each function performs an iterative
(no-recursion) walk with optional bounds and returns a sorted
Vec<PathBuf> for deterministic test output.
§Variants
walk_files— single-extension filter, no bounds.walk_files_multi— multiple extensions (case-insensitive).walk_files_bounded_depth— single extension with a maximum directory depth (for content trees).walk_files_bounded_count— single extension with a maximum file-count cap (for live-reload / batch I/O fast-paths).
All variants return Ok(Vec::new()) when the root directory does
not exist or is not a directory — matching the convention used by
every previous local collector in the crate.
§Symlinks
The collecting walkers follow symlinked directories, but enter each real directory (by canonical path) at most once. A link back to an ancestor is therefore skipped instead of walked again, so a symlink loop can neither repeat files nor make the walk branch without end. Subdirectories are visited in sorted order, so when one directory is reachable by two names the name kept is the same on every platform.
Functions§
- visit_
files_ bounded_ depth - Visits every file with extension
extunderdir, in a deterministic order, without materialising the file list. - walk_
files - Recursively collects files matching
extensionunderdir. - walk_
files_ bounded_ count - Recursively collects files matching
extension, capped atmax_files. Provideswith_contexton the underlyingread_dirfailure. - walk_
files_ bounded_ depth - Recursively collects files matching
extension, bounded by depth. - walk_
files_ multi - Recursively collects files matching any of
extensionsunderdir.