Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding all mounted volumes



How does one find all volumes/disks/whatever in a platform-agnostic way?

On OS X, File.listRoots() returns the following list:

/

Not very useful for what I need to do. Our legacy data contains file paths
which include the volume name and use old Mac syntax like so:

Foobar CD:Some Directory:subdir:file.ext

Now I need to manipulate these paths to find the actual file but it must
work on OS X, Windows 98 and later, and Linux/UNIX.

Is there a preferred way to enumerate volumes on OS X, and how does one
reconcile this with the other platforms? I'd be more inclined so set a
base search path that is platform-agnostic than write any OS detection
code:

File[] searchPath = new File[] {
new File("/"),
new File("/Volumes"),
new File("/mnt"), // should enumerate child dirs?
new File("/dev"), // "
// Windows? other?...
}

Am I on the right track? How do others deal with this issue?

Jason
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.