(
app_handle: tauri::AppHandle,
mut settings: AppSettings,
state: State<'_, Mutex<AppSettings>>,
)
| 433 | |
| 434 | #[tauri::command] |
| 435 | pub fn save_app_settings( |
| 436 | app_handle: tauri::AppHandle, |
| 437 | mut settings: AppSettings, |
| 438 | state: State<'_, Mutex<AppSettings>>, |
| 439 | ) -> Result<AppSettings, CommandError> { |
| 440 | let path = get_app_settings_path(&app_handle); |
| 441 | tracing::info!("{}", path.display()); |
| 442 | settings.sanitize(); |
| 443 | AppSettings::save_to_file(&settings, &path)?; |
| 444 | |
| 445 | let mut state = state.lock().unwrap(); |
| 446 | *state = settings.clone(); |
| 447 | |
| 448 | let path_display = path.display().to_string(); |
| 449 | let message = format!("App Settings saved: {path_display}"); |
| 450 | |
| 451 | app_handle.emit("log-message", LogMessage::new(LogLevel::INFO, message))?; |
| 452 | Ok(settings) |
| 453 | } |
| 454 | |
| 455 | fn get_app_settings_path(app_handle: &tauri::AppHandle) -> PathBuf { |
| 456 | let config_dir = app_handle |
nothing calls this directly
no test coverage detected