Open the cache, degrading to an empty cache on any problem. Missing file, unreadable file, or an unparseable/corrupt file all yield an empty cache — a broken cache must never block verification.
()
| 89 | /// Missing file, unreadable file, or an unparseable/corrupt file all |
| 90 | /// yield an empty cache — a broken cache must never block verification. |
| 91 | pub fn open() -> Self { |
| 92 | let dir = global_config_dir().unwrap_or_else(|| { |
| 93 | let home = dirs::home_dir().unwrap_or(PathBuf::from(".")); |
| 94 | home.join(".atomic") |
| 95 | }); |
| 96 | Self::open_at(dir.as_path()) |
| 97 | } |
| 98 | |
| 99 | /// Open the cache rooted at `dir` (used by tests). |
| 100 | pub fn open_at(dir: &Path) -> Self { |