05-09-2023, 04:18 AM
mnrvovrfc,
Using a command such as "vol F:" didn't quite work out for me.
But I have a solution that is working for me now. I started with a little proof of concept test and when that worked I put it in my 16,000+ line QB64PE code where it seems to be working flawlessly now.
What I discovered was that in each of these scenarios where a removable drive like a USB Flash Drive (UFD) still shows up in File Explorer with a drive letter but there are no actual partitions on the device, diskpart will list that volume as being 'Unusable". So, I simply have my code do this:
1) Generate a list of all volumes.
2) For any volume that is both removable type media AND having a status of "Unusable", I select that volume in Diskpart and issue a "remove letter=x" where x is the letter still showing up in File Explorer.
That frees up that drive letter and allows drive letter detection to then no longer stumble over these odd UFDs.
This is a program I've been working on and expanding / refining for several years now and all that time I have had these odd little corner cases with drive letter detection. I finally took about a day and half to do some intensive troubleshooting of the issue and it looks to me like I finally have this resolved.
Thanks to all for the suggestions and ideas.
Using a command such as "vol F:" didn't quite work out for me.
But I have a solution that is working for me now. I started with a little proof of concept test and when that worked I put it in my 16,000+ line QB64PE code where it seems to be working flawlessly now.
What I discovered was that in each of these scenarios where a removable drive like a USB Flash Drive (UFD) still shows up in File Explorer with a drive letter but there are no actual partitions on the device, diskpart will list that volume as being 'Unusable". So, I simply have my code do this:
1) Generate a list of all volumes.
2) For any volume that is both removable type media AND having a status of "Unusable", I select that volume in Diskpart and issue a "remove letter=x" where x is the letter still showing up in File Explorer.
That frees up that drive letter and allows drive letter detection to then no longer stumble over these odd UFDs.
This is a program I've been working on and expanding / refining for several years now and all that time I have had these odd little corner cases with drive letter detection. I finally took about a day and half to do some intensive troubleshooting of the issue and it looks to me like I finally have this resolved.
Thanks to all for the suggestions and ideas.