(&self, dir: &Path, files: &mut Vec<PathBuf>)
| 44 | } |
| 45 | |
| 46 | fn _scan_directory_recursive(&self, dir: &Path, files: &mut Vec<PathBuf>) { |
| 47 | if let Ok(entries) = fs::read_dir(dir) { |
| 48 | for entry in entries.flatten() { |
| 49 | let path = entry.path(); |
| 50 | if path.is_dir() { |
| 51 | // 跳过常见的忽略目录 |
| 52 | if let Some(name) = path.file_name().and_then(|n| n.to_str()) { |
| 53 | if name.starts_with('.') || name == "target" || name == "node_modules" || name == "__pycache__" { |
| 54 | continue; |
| 55 | } |
| 56 | } |
| 57 | self._scan_directory_recursive(&path, files); |
| 58 | } else if self.is_supported_file(&path) { |
| 59 | files.push(path); |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /// 判断文件是否为支持的源代码文件 |
| 66 | fn is_supported_file(&self, path: &Path) -> bool { |
no test coverage detected