Available Devices

BlitzMax Forums/BlitzMax Programming/Available Devices

Nigel Brown(Posted 2006) [#1]
Can anyone suggest a way of listing all available storage devices? Must be cross platform!

thinking of something that would return:

c:\ (Local Disk)
d:\ (CD Drive)
e:\ (Removeable Disk)


tonyg(Posted 2006) [#2]
Does this help?


Garrett(Posted 2006) [#3]
I've been working on some code for this myself, but for Linux and OS X. And
Brucey seems to be working on a module that handles all this also.

Here's the thread where he mentions his module and where I asked about
getting a list of drives:

http://www.blitzmax.com/Community/posts.php?topic=63394

I can share the code I have so far, it's for OS X only though, and would not be
reliable for Linux. Explaination for this is in the thread I note above there.

I don't have code for Linux yet because I was concerned about getting my OS X
code running first, since I work on a Mac of course ;-)

-Garrett


Beaker(Posted 2006) [#4]
Windows only:
Const DRIVE_UNKNOWN = 0
Const DRIVE_NO_ROOT_DIR = 1
Const DRIVE_REMOVABLE = 2
Const DRIVE_FIXED = 3
Const DRIVE_REMOTE = 4
Const DRIVE_RAMDISK = 5

Extern "Win32"
	Function GetDriveTypeA%(drive:Byte Ptr) "Win32"
End Extern


Print GetDriveTypeA("c:\")
Print GetDriveTypeA("D:\")



Brucey(Posted 2006) [#5]
As Garrett mentions, I have a functional module that works so far on Windows and Linux, using a standard interface for all platforms (in the BlitzMax way!).
With it you can list drives, get their types, sizes and free space.
Still missing OSX functionality... but that's next on the list :-)


Nigel Brown(Posted 2006) [#6]
Brucey, that sounds great. Am unable to see a module on your linked page called volumes? Do you have a direct link? Will have a look at the OSX stuff as I really need WIN32, MAC, LINUX in that order :-)


FlameDuck(Posted 2006) [#7]
ls /dev


Brucey(Posted 2006) [#8]
Duck, I tried that on windows but it says:

ls: /dev: No such file or directory

:-)


Brucey(Posted 2006) [#9]
Am unable to see a module on your linked page called volumes?

It's up on the site now (at the bottom due to alphabetical order).
Tested on win2k, fedora core 5, and ubuntu 5.10.

No OSX currently, as I haven't had a chance to do it yet... :-)


FlameDuck(Posted 2006) [#10]
Duck, I tried that on windows but it says:
Bloody Windows. I suppose you could make Cygwin a requirement... :o>