From 5435feb9329cef60c6e06dee7855fba645956bd5 Mon Sep 17 00:00:00 2001 From: Alexander Shaduri Date: Fri, 20 May 2022 13:04:26 +0400 Subject: [PATCH] Windows: Make sure we consider non-fixed drives as well, when detecting "Drive letters" for a drive. --- src/applib/storage_detector_win32.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/applib/storage_detector_win32.cpp b/src/applib/storage_detector_win32.cpp index c18eb9d..b590c01 100644 --- a/src/applib/storage_detector_win32.cpp +++ b/src/applib/storage_detector_win32.cpp @@ -114,9 +114,23 @@ std::map win32_get_drive_letter_map() for (char c = 'A'; c <= 'Z'; ++c) { if (drives[c - 'A']) { // drive is present debug_out_dump("app", "Windows drive found: " << c << ".\n"); - if (GetDriveType((c + std::string(":\\")).c_str()) == DRIVE_FIXED) { - debug_out_dump("app", "Windows drive " << c << " is fixed.\n"); - good_drives.push_back(c); + switch (auto drive_type = GetDriveType((c + std::string(":\\")).c_str())) { + case DRIVE_FIXED: + debug_out_dump("app", "Windows reports the drive " << c << " as fixed.\n"); + good_drives.push_back(c); + break; + case DRIVE_REMOVABLE: + debug_out_dump("app", "Windows reports the drive " << c << " as removable.\n"); + good_drives.push_back(c); + break; + case DRIVE_CDROM: + debug_out_dump("app", "Windows reports the drive " << c << " as cdrom.\n"); + good_drives.push_back(c); + break; + default: + debug_out_dump("app", "Windows reports the drive " << c << " as type " << drive_type << ".\n"); + // don't add + break; } } }