Don't canonicalize roots — \\?\UNC\... prefix breaks downstream Path ops
This commit is contained in:
parent
9d10c1f46f
commit
c5c38d1ce5
1 changed files with 6 additions and 5 deletions
|
|
@ -137,13 +137,14 @@ pub fn resolve_roots(
|
|||
}
|
||||
}
|
||||
|
||||
// Canonicalize + dedupe. canonicalize() can fail on UNC paths on some
|
||||
// Windows builds; if so, fall back to the raw path so we don't drop hits.
|
||||
// Dedup raw — DO NOT canonicalize. On Windows, canonicalize() rewrites
|
||||
// `\\wsl$\...` to `\\?\UNC\wsl$\...` (NT-namespace form), and `Path`
|
||||
// operations like `.parent()` and `.join()` get inconsistent on that
|
||||
// prefix, breaking downstream lookups (e.g. tier detection).
|
||||
let mut canon: Vec<PathBuf> = Vec::new();
|
||||
for p in roots {
|
||||
let c = std::fs::canonicalize(&p).unwrap_or(p);
|
||||
if !canon.contains(&c) {
|
||||
canon.push(c);
|
||||
if !canon.contains(&p) {
|
||||
canon.push(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue