From 26810fbcbde63bb1a3beb0c1cd26c86eac099593 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Tue, 17 Nov 2026 09:33:54 +0800 Subject: [PATCH] fix(welcome): a recent WSL project stored with forward slashes is not shown as missing (#3860) Recent projects are stored as `//wsl.localhost/Ubuntu/...`; the exemption for WSL shares (a stopped distribution only hides them) recognised the backslash form only. --- crates/ide-workspace/src/recent.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/ide-workspace/src/recent.rs b/crates/ide-workspace/src/recent.rs index 0b6b3feb8..7db02c3cd 100644 --- a/crates/ide-workspace/src/recent.rs +++ b/crates/ide-workspace/src/recent.rs @@ -156,7 +156,9 @@ pub fn with_live_branches(mut items: Vec) -> Vec { /// and WSL shares, which a stopped distribution only hides, never count as missing. fn is_missing(path: &Path) -> bool { let text = path.to_string_lossy(); - let wsl = text.starts_with(r"\\wsl$") || text.starts_with(r"\\wsl.localhost"); + // Stored paths may use `/` (`//wsl.localhost/Ubuntu/...`); host names ignore case. + let unc = text.replace('/', r"\").to_ascii_lowercase(); + let wsl = unc.starts_with(r"\\wsl$") || unc.starts_with(r"\\wsl.localhost"); path.is_absolute() && !text.contains("://") && !wsl && !path.exists() } @@ -258,6 +260,15 @@ impl RecentProjects { mod tests { use super::*; + #[test] + fn wsl_shares_stored_with_forward_slashes_are_never_missing() { + for path in + [r"\\wsl.localhost\Ubuntu\home\me\gone", "//wsl.localhost/Ubuntu/home/me/gone", "//WSL$/Ubuntu/gone"] + { + assert!(!is_missing(Path::new(path)), "{path}"); + } + } + #[test] fn newest_first_capped_and_persisted() { let tmp = tempfile::tempdir().unwrap();