fix(logging): include paths in file failure logs

This commit is contained in:
Tunglies
2026-09-21 15:57:31 +08:00
parent df79ed3efb
commit b469bee352
11 changed files with 104 additions and 45 deletions
+10 -4
View File
@@ -1,5 +1,5 @@
use crate::utils::dirs::{self, PathBufExec as _};
use anyhow::{Result, anyhow};
use anyhow::{Context as _, Result, anyhow};
use clash_verge_logging::{Type, logging};
use std::fs;
use std::os::windows::process::CommandExt as _;
@@ -100,8 +100,14 @@ async fn cleanup_legacy_shortcuts() -> Result<()> {
let old_shortcut = startup_dir.join("Clash-Verge.lnk");
let new_shortcut = startup_dir.join("Clash Verge.lnk");
old_shortcut.remove_if_exists().await?;
new_shortcut.remove_if_exists().await?;
old_shortcut
.remove_if_exists()
.await
.with_context(|| format!("failed to remove startup shortcut {}", old_shortcut.display()))?;
new_shortcut
.remove_if_exists()
.await
.with_context(|| format!("failed to remove startup shortcut {}", new_shortcut.display()))?;
Ok(())
}
@@ -327,7 +333,7 @@ pub async fn set_auto_launch(is_enable: bool, is_admin: bool) -> Result<()> {
let other = if is_admin { TaskMode::User } else { TaskMode::Admin };
if let Err(err) = cleanup_legacy_shortcuts().await {
logging!(warn, Type::Setup, "Failed to cleanup legacy startup shortcuts: {}", err);
logging!(warn, Type::Setup, "Failed to cleanup legacy startup shortcuts: {err:#}");
}
if is_enable {