MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / walk

Function walk

build.rs:321–335  ·  view source on GitHub ↗
(base: &Path, dir: &Path, out: &mut Vec<String>)

Source from the content-addressed store, hash-verified

319/// forward-slash separators. Returns sorted paths so codegen is deterministic.
320fn collect_files_relative(root: &Path) -> Vec<String> {
321 fn walk(base: &Path, dir: &Path, out: &mut Vec<String>) {
322 let Ok(entries) = fs::read_dir(dir) else {
323 return;
324 };
325 for entry in entries.flatten() {
326 let path = entry.path();
327 if path.is_dir() {
328 walk(base, &path, out);
329 } else if path.is_file() {
330 if let Ok(relative) = path.strip_prefix(base) {
331 out.push(relative.to_string_lossy().replace('\\', "/"));
332 }
333 }
334 }
335 }
336 let mut files = Vec::new();
337 walk(root, root, &mut files);
338 files.sort();

Callers 1

collect_files_relativeFunction · 0.70

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected