Save configuration
(&self)
| 161 | |
| 162 | /// Save configuration |
| 163 | pub fn save(&self) -> Result<()> { |
| 164 | let config_path = Self::config_path()?; |
| 165 | |
| 166 | if let Some(parent) = config_path.parent() { |
| 167 | fs::create_dir_all(parent)?; |
| 168 | } |
| 169 | |
| 170 | let content = toml::to_string_pretty(self)?; |
| 171 | fs::write(&config_path, content)?; |
| 172 | tracing::info!("Saved config: {:?}", config_path); |
| 173 | Ok(()) |
| 174 | } |
| 175 | |
| 176 | /// Get configuration directory |
| 177 | pub fn config_dir() -> Result<PathBuf> { |
no test coverage detected