Loads the user-level config file. Returns defaults if the file is missing or unreadable.
()
| 154 | /// Loads the user-level config file. |
| 155 | /// Returns defaults if the file is missing or unreadable. |
| 156 | pub fn load() -> Self { |
| 157 | let Some(path) = config_path() else { |
| 158 | return Self::default(); |
| 159 | }; |
| 160 | let Ok(contents) = std::fs::read_to_string(&path) else { |
| 161 | return Self::default(); |
| 162 | }; |
| 163 | toml::from_str(&contents).unwrap_or_default() |
| 164 | } |
| 165 | |
| 166 | /// Saves the user-level config file. Best-effort. |
| 167 | /// Returns true if the file was saved, false on any error. |
no test coverage detected