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

Method walk_files_recursive

atomic-core/src/output/filesystem/walk.rs:56–84  ·  view source on GitHub ↗

Recursive helper for walk_files.

(&self, dir: &Path, files: &mut Vec<String>)

Source from the content-addressed store, hash-verified

54
55 /// Recursive helper for walk_files.
56 fn walk_files_recursive(&self, dir: &Path, files: &mut Vec<String>) -> io::Result<()> {
57 if !dir.is_dir() {
58 return Ok(());
59 }
60
61 for entry in fs::read_dir(dir)? {
62 let entry = entry?;
63 let path = entry.path();
64 let file_name = entry.file_name().to_string_lossy().to_string();
65
66 // Skip the .atomic directory
67 if file_name == DOT_DIR {
68 continue;
69 }
70
71 let file_type = entry.file_type()?;
72
73 if file_type.is_dir() {
74 self.walk_files_recursive(&path, files)?;
75 } else if file_type.is_file() {
76 // Convert to relative path
77 if let Ok(relative) = path.strip_prefix(self.root()) {
78 files.push(relative.to_string_lossy().to_string());
79 }
80 }
81 }
82
83 Ok(())
84 }
85
86 /// Check if a path is the Atomic metadata directory or inside it.
87 pub fn is_atomic_path(&self, path: &str) -> bool {

Callers 1

walk_filesMethod · 0.80

Calls 6

is_dirMethod · 0.80
file_nameMethod · 0.80
pathMethod · 0.45
is_fileMethod · 0.45
rootMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected