Hi, I would like to know what's the best way to check the drive type using Java SDK 1.3 on Windows platform? For example, is there a way to check if the file is on a CDROM or a Hard Drive. Basically I would like to know if its a writable drive or not. Thanks in advance, Gil.
Note that although Windows has the "drive" concept, UNIX puts all mounted media into a single file system. My CD drive is a directory named /mnt/cdrom, for example. If you try to enumerate the filesystem roots on a UNIX machine, you'll just get one, even if many physical devices are attached. So what I'm getting at is that the concept of a "writeable drive" is both system-dependent and somewhat nebulous. Anyway, the best way to determine if a particular area is writeable is to try to write to it and see what happens.
Thanks for the help. I initially wanted to use some Win API, but I think you are right, this would make it platform dependent and I shortest way might be just to write and check for an error.
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop