MCPcopy Create free account
hub / github.com/AdbAutoPlayer/AdbAutoPlayer / save_app_settings

Function save_app_settings

src-tauri/src/settings.rs:435–453  ·  view source on GitHub ↗
(
    app_handle: tauri::AppHandle,
    mut settings: AppSettings,
    state: State<'_, Mutex<AppSettings>>,
)

Source from the content-addressed store, hash-verified

433
434#[tauri::command]
435pub 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
455fn get_app_settings_path(app_handle: &tauri::AppHandle) -> PathBuf {
456 let config_dir = app_handle

Callers

nothing calls this directly

Calls 3

get_app_settings_pathFunction · 0.85
sanitizeMethod · 0.80
emitMethod · 0.45

Tested by

no test coverage detected