fix download bug

This commit is contained in:
Julian Freeman
2026-03-31 01:04:32 -04:00
parent 6a360dc14b
commit 50489bb9d4
2 changed files with 21 additions and 11 deletions

View File

@@ -26,6 +26,7 @@ pub struct EssentialsRepo {
pub struct InstallTask {
pub id: String,
pub version: Option<String>,
#[serde(default)]
pub use_manifest: bool,
pub manifest_url: Option<String>,
}
@@ -168,13 +169,10 @@ async fn get_updates(app: AppHandle) -> Vec<Software> {
#[tauri::command]
async fn install_software(
id: String,
version: Option<String>,
use_manifest: bool,
manifest_url: Option<String>,
task: InstallTask,
state: State<'_, AppState>
) -> Result<(), String> {
state.install_tx.send(InstallTask { id, version, use_manifest, manifest_url }).await.map_err(|e| e.to_string())
state.install_tx.send(task).await.map_err(|e| e.to_string())
}
#[tauri::command]
@@ -345,6 +343,11 @@ pub fn run() {
});
emit_log(&handle, &log_id, "Result", &format!("Execution finished: {}", status_result), if status_result == "success" { "success" } else { "error" });
// 3. 清理临时清单文件
if let Some(path) = temp_manifest_path {
let _ = fs::remove_file(path);
}
}
});