Re: Can these be done in Cocoa?
Re: Can these be done in Cocoa?
- Subject: Re: Can these be done in Cocoa?
- From: Douglas Davidson <email@hidden>
- Date: Fri, 4 Jan 2002 09:43:15 -0800
1. In my first column, I'd like to present a list of the volumes
currently mounted. I'm able to determine what the UNIX mount points of
the volumes are using NSWorkspace's mountedLocalVolumePaths method. I
use this to get the icon for each volume using NSWorkspace's
iconForFile method, and I assume that the last path portion of each
mount point within /Volumes is the name of the volume itself. (As it
seems to be for every test case I've come up with thusfar.) However,
the boot-up hard drive itself is mounted simply as "/", so my method of
determining the volume name does not work in this case. I've searched
every relevant Cocoa class I can find, but I don'
t see any methods for returning volume names. Can anyone point me in
the right direction?
NSWorkspace currently does not deal in volume names. Also, the name of
the mount point need not be the name of the volume. You can use Carbon
calls--for example, FSGetVolumeInfo--to obtain the correct volume name.
It should be fairly straightforward to go from path to FSRef to volume
reference number to volume name, but perhaps someone will be kind enough
to post a code sample...if not, I can produce one.
Douglas Davidson