Mailing Lists: Apple Mailing Lists

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

Re: Finding startup volume name?



Greg Guerin wrote:

Rolf Howarth wrote:

Is there a simple way to find the startup volume name? I can think of a
couple of ways using Runtime.exec(): do "ls -l /Volumes" and see what links
to /,

Or get a File.listFiles() of /Volumes in Java and call getCanonicalPath()
on each File (optional: in a filter object). The one that resolves to "/"
is the startup volume, and you can then use the uncanonical path (i.e. the
pathname of the symlink) as desired.


This won't work before 10.4, which I think is when the "symlink to startup
volume" first appeared. Or maybe it was 10.3. Anyway, if nothing
canonicalizes to "/", I think you're stuck, if the pathname problem is that
serious.

You can exec the command:

osascript -e 'tell app "Finder" to return the name of the startup disk'

and then parse the output from the Process object.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


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.