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

@@ -6,7 +6,7 @@ use crate::{
logging,
process::AsyncHandler,
utils::{
dirs::{self, service_log_dir, sidecar_log_dir},
dirs::{self, PathBufExec, service_log_dir, sidecar_log_dir},
help,
logging::Type,
},
@@ -167,8 +167,7 @@ pub async fn delete_log() -> Result<()> {
let duration = now.signed_duration_since(file_time);
if duration.num_days() > day {
let file_path = file.path();
let _ = fs::remove_file(file_path).await;
let _ = file.path().remove_if_exists().await;
logging!(info, Type::Setup, "delete log file: {}", file_name);
}
}