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: Names of drives



Moises Lejter <email@hidden> wrote:

>OK. Acrobat gives me a pathname "/A/B/C". On MacOSX, it looks like
>A is always the disk name, while /B/C is a pathname within that disk.
>My problem is that I cannot use what I get directly - /A/B/C does
>not exist on the filesystem. I have to use /B/C (if A is the book disk)
>or I guess /Volumes/A/B/C otherwise. I was hoping to be able to tell
>which of the two was appropriate, rather than try one, then the other.
>And yes, I could always try one, then the other.

You will have to be prepared to make multiple attempts anyway, so you may
as well accept that you'll have to write the code.

The volumes mounted in "/Volumes" have unique directory names, and the
mounting algorithm will number them to ensure they are unique. So if you
have two volumes whose Finder-visible name is "Foo", only one of them is
"/Volumes/Foo", while the other will have a number appended to it. The
best way to see this is to create a disk-image file, duplicate the file,
then mount both at the same time. An 'ls -l /Volumes' will show what
happens. The numbers DO NOT represent "the Nth 'Foo' mounted".

To get the volume-name of the startup drive, you can exec() this command
and read its stdout stream:
osascript -e 'path to startup disk as string'

DO NOT use exec(String); use exec(String[]) with the strings pre-parsed.
Runtime.exec(String) DOES NOT understand or respect quoting.

Also, exec()'ing osascript is not something you'll want to do repeatedly at
high rates of speed.

-- GG
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
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.