#![allow(non_snake_case)] use tauri::AppHandle; /// 获取设置 #[tauri::command] pub async fn get_settings() -> Result { Ok(crate::settings::get_settings()) } /// 保存设置 #[tauri::command] pub async fn save_settings(settings: crate::settings::AppSettings) -> Result { crate::settings::update_settings(settings) .map_err(|e| e.to_string())?; Ok(true) } /// 重启应用程序(当 app_config_dir 变更后使用) #[tauri::command] pub async fn restart_app(app: AppHandle) -> Result { app.restart(); } /// 获取 app_config_dir 覆盖配置 (从 Store) #[tauri::command] pub async fn get_app_config_dir_override(app: AppHandle) -> Result, String> { Ok(crate::app_store::get_app_config_dir_from_store(&app) .map(|p| p.to_string_lossy().to_string())) } /// 设置 app_config_dir 覆盖配置 (到 Store) #[tauri::command] pub async fn set_app_config_dir_override( app: AppHandle, path: Option, ) -> Result { crate::app_store::set_app_config_dir_to_store(&app, path.as_deref())?; Ok(true) }