Skip to content

Commit 3d8abca

Browse files
committed
feat (core): 移除无效检查代码
1 parent 3c56d12 commit 3d8abca

1 file changed

Lines changed: 2 additions & 39 deletions

File tree

src-tauri/src/update.rs

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -261,45 +261,8 @@ async fn do_update(
261261
async fn do_install(
262262
update_path: &std::path::Path,
263263
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
264-
#[cfg(target_os = "windows")]
265-
{
266-
let current_exe = std::env::current_exe()?;
267-
let backup_path = current_exe.with_extension("exe.backup");
268-
269-
// 备份当前文件
270-
std::fs::copy(&current_exe, &backup_path)?;
271-
272-
// 创建更新脚本
273-
let script_path = std::env::temp_dir().join("update.bat");
274-
let script_content = format!(
275-
r#"@echo off
276-
timeout /t 2 /nobreak >nul
277-
copy /Y "{}" "{}"
278-
start "" "{}"
279-
del "%~f0"
280-
"#,
281-
update_path.display(),
282-
current_exe.display(),
283-
current_exe.display()
284-
);
285-
286-
std::fs::write(&script_path, script_content)?;
287-
288-
// 启动脚本
289-
std::process::Command::new("cmd")
290-
.args(&["/C", "start", "", "/min", script_path.to_str().unwrap()])
291-
.spawn()?;
292-
293-
// 等待一秒后退出
294-
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
295-
std::process::exit(0);
296-
}
297-
298-
#[cfg(not(target_os = "windows"))]
299-
{
300-
let current_exe = std::env::current_exe()?;
301-
std::fs::copy(update_path, &current_exe)?;
302-
}
264+
let current_exe = std::env::current_exe()?;
265+
std::fs::copy(update_path, &current_exe)?;
303266

304267
Ok(())
305268
}

0 commit comments

Comments
 (0)