Recursive helper for walk_files.
(&self, dir: &Path, files: &mut Vec<String>)
| 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 { |