| 51 | /// implicitly during test runtime. |
| 52 | #[cfg(test)] |
| 53 | fn normalize_test_path(path: impl AsRef<Path>) -> PathBuf { |
| 54 | #[cfg(windows)] |
| 55 | { |
| 56 | use typed_path::Utf8TypedPath; |
| 57 | let path_ref = path.as_ref(); |
| 58 | |
| 59 | // Only process string paths with forward slashes |
| 60 | let typed_path = Utf8TypedPath::derive(path_ref.to_str().unwrap()); |
| 61 | if typed_path.is_unix() { |
| 62 | let windows_path = typed_path.with_windows_encoding().to_string(); |
| 63 | |
| 64 | // If path is absolute (starts with /) and doesn't already have a drive letter |
| 65 | if PathBuf::from(&windows_path).has_root() { |
| 66 | // Prepend C: drive letter to make it truly absolute on Windows |
| 67 | return PathBuf::from(format!("C:{}", windows_path)); |
| 68 | } |
| 69 | |
| 70 | return PathBuf::from(windows_path); |
| 71 | } |
| 72 | } |
| 73 | path.as_ref().to_path_buf() |
| 74 | } |
| 75 | |
| 76 | /// Cross-platform path append that handles test paths consistently |
| 77 | fn append(base: impl AsRef<Path>, path: impl AsRef<Path>) -> PathBuf { |