Forum Navigation
Drive Detection and Drive Information
Posted: 02/09/08 23:50:34Im new to D and Tango, and just wrote my first project for it and I like it.
I have a larger project comming up and I was thinking of useing D. My primary problem is that I need detect disk changes and get information about the disk, ie volume name, serial, ect.. Basicly I need to detect removable media and need to beable to tell which disk is which.. I also wish to be windows\linux\bsd\osX? portable....
Any suggestion?
I'm currently messing with this code...
//Disk.d module Disk;
import tango.io.Stdout;
import tango.io.FileRoots?;
import tango.core.Thread;
auto running = true;
void main() {
auto listRunner = new Thread(&list);
listRunner.start();
while(running)
Thread.sleep(60);
}
void list() {
static uint driveMask;
while(running) {
foreach(drive; FileRoots?.list())
Stdout(drive).newline;
Thread.getThis.sleep(5);
}
}