diff --git a/CHANGELOG.md b/CHANGELOG.md index 66a519ed..f9f32b8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/src/scsi/windows.rs b/src/scsi/windows.rs index bc140f54..699a2f0e 100644 --- a/src/scsi/windows.rs +++ b/src/scsi/windows.rs @@ -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) } diff --git a/src/scsi/windows_tests.rs b/src/scsi/windows_tests.rs index 08cf4ae0..03da36ce 100644 --- a/src/scsi/windows_tests.rs +++ b/src/scsi/windows_tests.rs @@ -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"); }