Canonicalize a path, stripping the Windows `\\?\` UNC prefix to avoid polluting workspace strings throughout the system (prompts, session data, etc.).
(path: &Path)
| 76 | /// Canonicalize a path, stripping the Windows `\\?\` UNC prefix to avoid |
| 77 | /// polluting workspace strings throughout the system (prompts, session data, etc.). |
| 78 | fn safe_canonicalize(path: &Path) -> PathBuf { |
| 79 | match std::fs::canonicalize(path) { |
| 80 | Ok(p) => strip_unc_prefix(p), |
| 81 | Err(_) => path.to_path_buf(), |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | /// Strip the Windows extended-length path prefix (`\\?\`) that `canonicalize()` adds. |
| 86 | /// On non-Windows this is a no-op. |
no test coverage detected