• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I check the drive type?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic