From ec3aabe2c2802ff7ee2d51130aa73fe169bb4fd0 Mon Sep 17 00:00:00 2001 From: CharlesChen0823 Date: Thu, 9 May 2024 02:12:07 +0800 Subject: [PATCH] windows: Fix crash when saving files to disk (#11547) closes #11544, sorry for introduce this issue by pre pr. Release Notes: - N/A --- crates/worktree/src/worktree.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs index 4711aed9b5..3fec793db5 100644 --- a/crates/worktree/src/worktree.rs +++ b/crates/worktree/src/worktree.rs @@ -674,7 +674,7 @@ fn start_background_scan_tasks( let (scan_states_tx, mut scan_states_rx) = mpsc::unbounded(); let background_scanner = cx.background_executor().spawn({ let abs_path = if cfg!(target_os = "windows") { - abs_path.canonicalize().expect("start background scan tasks failed for canonicalize path {abs_path}") + abs_path.canonicalize().unwrap_or_else(|_| abs_path.to_path_buf()) } else { abs_path.to_path_buf() };