Notify on opening WSL paths outside of wsl (#40195)

Closes #27340

Release Notes:

- N/A

---------

Co-authored-by: John Tur <john-tur@outlook.com>
This commit is contained in:
Julia Ryan
2025-10-25 01:44:32 +00:00
committed by GitHub
co-authored by John Tur
parent 1dffdea27c
commit 7433d85458
11 changed files with 250 additions and 72 deletions
+4 -22
View File
@@ -1348,28 +1348,10 @@ impl WorkspaceDb {
}
let has_wsl_path = if cfg!(windows) {
fn is_wsl_path(path: &PathBuf) -> bool {
use std::path::{Component, Prefix};
path.components()
.next()
.and_then(|component| match component {
Component::Prefix(prefix) => Some(prefix),
_ => None,
})
.and_then(|prefix| match prefix.kind() {
Prefix::UNC(server, _) => Some(server),
Prefix::VerbatimUNC(server, _) => Some(server),
_ => None,
})
.map(|server| {
let server_str = server.to_string_lossy();
server_str == "wsl.localhost" || server_str == "wsl$"
})
.unwrap_or(false)
}
paths.paths().iter().any(|path| is_wsl_path(path))
paths
.paths()
.iter()
.any(|path| util::paths::WslPath::from_path(path).is_some())
} else {
false
};