MCPcopy Create free account
hub / github.com/PerroEngine/Perro / walk_dir

Function walk_dir

perro_source/io_stack/perro_assets/src/walkdir.rs:4–19  ·  view source on GitHub ↗

Visits all files in a directory tree, calling the provided callback for each file.

(dir: &Path, callback: &mut F)

Source from the content-addressed store, hash-verified

2 collections::HashSet,
3 fs, io,
4 path::{Path, PathBuf},
5 sync::{LazyLock, RwLock},
6};
7
8#[cfg(windows)]
9use std::os::windows::fs::MetadataExt;
10
11static PATH_EXCLUSIONS: LazyLock<RwLock<Vec<CompiledPathPattern>>> =
12 LazyLock::new(|| RwLock::new(Vec::new()));
13
14#[must_use = "dropping the guard restores prior path exclusions"]
15pub struct PathExclusionGuard {
16 previous: Vec<CompiledPathPattern>,
17}
18
19pub fn push_path_exclusions(patterns: Vec<String>) -> PathExclusionGuard {
20 let compiled = patterns
21 .iter()
22 .map(|pattern| CompiledPathPattern::new(pattern))

Callers 2

collect_filesFunction · 0.70
collect_file_pathsFunction · 0.70

Calls 2

read_dirFunction · 0.85
pathMethod · 0.45

Tested by

no test coverage detected