fix(windows): a bare drive letter opens that drive

`E` was normalized to \\.\E, which does not exist, so `fmv-key E` and
`freemkv-flash E` failed with E1000. It now opens \\.\E:, as `E:` does.
This commit is contained in:
Matthew Jackson
2026-10-07 00:31:32 -07:00
parent 6980b04e63
commit 959800adec
3 changed files with 10 additions and 0 deletions
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [Unreleased]
- Windows: a bare drive letter (`E`) opens that drive, as `E:` does; it was opened as `\\.\E`, which does not exist (E1000).
## [1.8.1] — 2026-10-07
- `DriveInfo::display_name` is the name the OS shows users: the drive letter (`E:`) on Windows, `/dev/srN` on Linux and `diskN` on macOS while a disc is mounted; it equals `path` when the OS has no name. `path` remains the selector to open. Windows lists lettered drives in letter order, then unlettered drives by `CdRomN`.
+4
View File
@@ -184,6 +184,10 @@ fn normalize_device_path(path: &str) -> String {
if trimmed.len() == 2 && trimmed.as_bytes()[1] == b':' {
return format!("\\\\.\\{}", trimmed);
}
// A bare drive letter (`E`) is that drive, as `E:` is.
if trimmed.len() == 1 && trimmed.as_bytes()[0].is_ascii_alphabetic() {
return format!("\\\\.\\{trimmed}:");
}
format!("\\\\.\\{}", path)
}
+2
View File
@@ -6,6 +6,8 @@ fn normalize_device_path_maps_drive_forms_to_the_volume_path() {
assert_eq!(normalize_device_path("D:"), r"\\.\D:");
assert_eq!(normalize_device_path(r"D:\"), r"\\.\D:");
assert_eq!(normalize_device_path(r"\\.\D:"), r"\\.\D:");
assert_eq!(normalize_device_path("E"), r"\\.\E:");
assert_eq!(normalize_device_path("e"), r"\\.\e:");
assert_eq!(normalize_device_path(r"\\.\CdRom0"), r"\\.\CdRom0");
assert_eq!(normalize_device_path("CdRom0"), r"\\.\CdRom0");
}