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

@@ -495,7 +495,7 @@ impl IProfiles {
}
/// 以 app 中的 profile 列表为准,删除不再需要的文件
pub fn cleanup_orphaned_files(&self) -> Result<CleanupResult> {
pub async fn cleanup_orphaned_files(&self) -> Result<CleanupResult> {
let profiles_dir = dirs::app_profiles_dir()?;
if !profiles_dir.exists() {
@@ -538,7 +538,7 @@ impl IProfiles {
// 检查是否为活跃文件
if !active_files.contains(file_name) {
match std::fs::remove_file(&path) {
match path.to_path_buf().remove_if_exists().await {
Ok(_) => {
deleted_files.push(file_name.into());
log::info!(target: "app", "已清理冗余文件: {file_name}");