Using Filetype("A:/") in windowed mode

BlitzMax Forums/BlitzMax Programming/Using Filetype("A:/") in windowed mode

Chalky(Posted 2007) [#1]
I am using the following code to test for all available devices:
For k% = 1 To 26
	FileName$=Chr$(64+k%)+":/"
	If FileType(FileName$)=2 Then
		'
		' get volume info and drive type
		'
	EndIf
Next

The code works fine and I am able to retrieve the information for all available drives without problems - as long as I'm running it in fullscreen mode. As soon as I run it in windowed mode, I get the following error when filename$="A:/" and no disk is inserted:

Windows - No Disk

Exception Processing Message c0000013 Parameters 75b6bf9c 4 75b6bf9c 75b6bf9c

Cancel  | Try Again | Continue


What I don't understand is that although the A: drive grinds for a second or two in both fullscreen and windowed mode, the error only appears in windowed mode - and stops program execution. Surely BlitzMax should deal with this type of Exception no matter what the screen mode?

Does anyone know of a way to make FileType("A:/") with no disk inserted work without the Exception message in windowed mode?


SebHoll(Posted 2007) [#2]
Why don't you try using Brucey's BaH.Volume module? It provides a couple of functions that list all available devices, but also makes it possible to retrieve the paths of special directories (e.g. user documents/desktop). And, like all of Brucey's modules, it's cross-platform. The ListVolumes() functions is probably what you are after.

You can syncmod it, or download it from here. If you do download it, you will have to copy it into your BlitzMax\mod folder, then build modules from within the IDE.


Chalky(Posted 2007) [#3]
@SebHoll - I've solved the problem by using GetLogicalDrives which happily returns all available drive letters regardless of whether a disk is present - and without any error message. I might check out the BaH.Volume module if I get stuck on something I can't solve myself later on...