Fix of PrusaSlicer trying to access my floppy disk (A:\)
Some customers seem to posses a floppy drive (sic!) and some floppy drives start spinning if accessed just to check whether there is a medium plugged in or not. From now, the A: and B: drives are not checked anymore for removable media. Now let's pray nobody maps an SD card or flash drive to A: or B: Fixes https://forum.prusaprinters.org/forum/prusaslicer/prusaslicer-trying-to-access-my-floppy-disk-a
This commit is contained in:
parent
a1aee69c5a
commit
3fdd643f49
@ -33,17 +33,19 @@ wxDEFINE_EVENT(EVT_REMOVABLE_DRIVES_CHANGED, RemovableDrivesChangedEvent);
|
|||||||
#if _WIN32
|
#if _WIN32
|
||||||
std::vector<DriveData> RemovableDriveManager::search_for_removable_drives() const
|
std::vector<DriveData> RemovableDriveManager::search_for_removable_drives() const
|
||||||
{
|
{
|
||||||
//get logical drives flags by letter in alphabetical order
|
// Get logical drives flags by letter in alphabetical order.
|
||||||
DWORD drives_mask = ::GetLogicalDrives();
|
DWORD drives_mask = ::GetLogicalDrives();
|
||||||
|
|
||||||
// Allocate the buffers before the loop.
|
// Allocate the buffers before the loop.
|
||||||
std::wstring volume_name;
|
std::wstring volume_name;
|
||||||
std::wstring file_system_name;
|
std::wstring file_system_name;
|
||||||
// Iterate the Windows drives from 'A' to 'Z'
|
// Iterate the Windows drives from 'C' to 'Z'
|
||||||
std::vector<DriveData> current_drives;
|
std::vector<DriveData> current_drives;
|
||||||
for (size_t i = 0; i < 26; ++ i)
|
// Skip A and B drives.
|
||||||
if (drives_mask & (1 << i)) {
|
drives_mask >>= 2;
|
||||||
std::string path { char('A' + i), ':' };
|
for (char drive = 'C'; drive <= 'Z'; ++ drive, drives_mask >>= 1)
|
||||||
|
if (drives_mask & 1) {
|
||||||
|
std::string path { drive, ':' };
|
||||||
UINT drive_type = ::GetDriveTypeA(path.c_str());
|
UINT drive_type = ::GetDriveTypeA(path.c_str());
|
||||||
// DRIVE_REMOVABLE on W are sd cards and usb thumbnails (not usb harddrives)
|
// DRIVE_REMOVABLE on W are sd cards and usb thumbnails (not usb harddrives)
|
||||||
if (drive_type == DRIVE_REMOVABLE) {
|
if (drive_type == DRIVE_REMOVABLE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user