fix(updater): install the already downloaded update instead of fetching it again

This commit is contained in:
wonfen
2026-10-06 14:21:09 +08:00
parent 6ec35c8195
commit c341b9b238
8 changed files with 162 additions and 111 deletions
+9 -1
View File
@@ -1,5 +1,5 @@
use super::CmdResult;
use crate::{cmd::StringifyErr as _, feat, utils::dirs};
use crate::{cmd::StringifyErr as _, core::SilentUpdater, feat, utils::dirs};
use smartstring::alias::String;
use tauri::{AppHandle, Manager as _};
@@ -44,6 +44,14 @@ pub async fn restart_app() -> CmdResult<()> {
Ok(())
}
#[tauri::command]
pub async fn install_cached_update(app_handle: AppHandle, version: String) -> CmdResult<bool> {
SilentUpdater::global()
.install_cached(&app_handle, &version)
.await
.stringify_err()
}
#[tauri::command]
pub fn get_app_dir() -> CmdResult<String> {
let app_home_dir = dirs::app_home_dir().stringify_err()?.to_string_lossy().into();