| 36 | } |
| 37 | |
| 38 | fn repos(&self, root: &PathBuf) -> Result<Vec<RepoId>> { |
| 39 | let paths = fs::read_dir(root)?; |
| 40 | |
| 41 | let mut repos = vec![]; |
| 42 | for path in paths { |
| 43 | let path = path?.path(); |
| 44 | |
| 45 | let filename = match &path.file_name() { |
| 46 | Some(filename) => match filename.to_str() { |
| 47 | Some(filename) => filename, |
| 48 | None => { |
| 49 | log::error!("expected a filename: {:?}", path); |
| 50 | continue; |
| 51 | } |
| 52 | }, |
| 53 | None => { |
| 54 | log::error!("expected a filename: {:?}", path); |
| 55 | continue; |
| 56 | } |
| 57 | }; |
| 58 | |
| 59 | let id = filename.to_string(); |
| 60 | repos.push(RepoId::try_from(&id)?); |
| 61 | } |
| 62 | |
| 63 | Ok(repos) |
| 64 | } |
| 65 | } |