Windows: Make sure we consider non-fixed drives as well, when detecting "Drive letters" for a drive.

This commit is contained in:
Alexander Shaduri
2022-05-20 13:04:26 +04:00
parent 02e4f8e536
commit 5435feb932
+17 -3
View File
@@ -114,9 +114,23 @@ std::map<char, DriveLetterInfo> 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;
}
}
}