• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I check the drive type?  RSS feed

 
Gilberto Gil
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gilberto Gil
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!