• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • 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: 24204
44
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.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic