获取已保存的文件信息
(&self, project_id: &str)
| 202 | |
| 203 | /// 获取已保存的文件信息 |
| 204 | pub fn get_saved_files_info(&self, project_id: &str) -> io::Result<Vec<String>> { |
| 205 | let project_dir = self.project_dir(project_id); |
| 206 | let mut files = Vec::new(); |
| 207 | |
| 208 | if !project_dir.exists() { |
| 209 | return Ok(files); |
| 210 | } |
| 211 | |
| 212 | for entry in fs::read_dir(&project_dir)? { |
| 213 | let entry = entry?; |
| 214 | if entry.file_type()?.is_file() { |
| 215 | if let Some(name) = entry.file_name().to_str() { |
| 216 | let metadata = entry.metadata()?; |
| 217 | let size = metadata.len(); |
| 218 | files.push(format!("{} ({} bytes)", name, size)); |
| 219 | } |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | Ok(files) |
| 224 | } |
| 225 | |
| 226 | // ---- Projects registry (for parsed projects) ---- |
| 227 |
nothing calls this directly
no test coverage detected