(&self)
| 230 | } |
| 231 | |
| 232 | fn load_registry(&self) -> io::Result<ProjectsRegistry> { |
| 233 | let path = self.registry_path(); |
| 234 | if !path.exists() { |
| 235 | return Ok(ProjectsRegistry::default()); |
| 236 | } |
| 237 | let content = fs::read_to_string(path)?; |
| 238 | let reg: ProjectsRegistry = serde_json::from_str(&content) |
| 239 | .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; |
| 240 | Ok(reg) |
| 241 | } |
| 242 | |
| 243 | fn save_registry(&self, registry: &ProjectsRegistry) -> io::Result<()> { |
| 244 | let path = self.registry_path(); |
no test coverage detected