MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / collect_files

Function collect_files

atomic-cli/src/commands/status_git.rs:305–324  ·  view source on GitHub ↗
(base: &Path, directory: &Path, output: &mut Vec<String>, depth: usize)

Source from the content-addressed store, hash-verified

303}
304
305fn collect_files(base: &Path, directory: &Path, output: &mut Vec<String>, depth: usize) {
306 if depth > 8 {
307 return;
308 }
309 let Ok(entries) = std::fs::read_dir(directory) else {
310 return;
311 };
312 for entry in entries.flatten() {
313 let path = entry.path();
314 if path.is_dir() {
315 collect_files(base, &path, output, depth + 1);
316 } else {
317 let relative = path
318 .strip_prefix(base)
319 .map(Path::to_string_lossy)
320 .unwrap_or_default();
321 output.push(relative.replace('\\', "/"));
322 }
323 }
324}
325
326fn stage_code_string(code: StageCode) -> String {
327 code.glyph().to_string()

Callers 1

Calls 4

is_dirMethod · 0.80
pathMethod · 0.45
pushMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected