refactor: convert synchronous file operations to asynchronous for improved performance (#5059)

* refactor: convert synchronous file operations to asynchronous for improved performance

* fix: update copy_icon_file to use asynchronous directory creation

* refactor: remove unnecessary variable assignments in shortcut management functions
This commit is contained in:
Tunglies
2025-10-14 19:55:22 +08:00
committed by GitHub
parent 8760ed17dc
commit 7c71d07ad2
7 changed files with 75 additions and 77 deletions

View File

@@ -241,14 +241,14 @@ impl Sysopt {
#[cfg(target_os = "windows")]
{
if is_enable {
if let Err(e) = startup_shortcut::create_shortcut() {
if let Err(e) = startup_shortcut::create_shortcut().await {
log::error!(target: "app", "创建启动快捷方式失败: {e}");
// 如果快捷方式创建失败,回退到原来的方法
self.try_original_autostart_method(is_enable);
} else {
return Ok(());
}
} else if let Err(e) = startup_shortcut::remove_shortcut() {
} else if let Err(e) = startup_shortcut::remove_shortcut().await {
log::error!(target: "app", "删除启动快捷方式失败: {e}");
self.try_original_autostart_method(is_enable);
} else {