Re: network volume names changing etc.
Re: network volume names changing etc.
- Subject: Re: network volume names changing etc.
- From: Ken Thomases <email@hidden>
- Date: Sun, 26 Jun 2011 20:48:11 -0500
On Jun 26, 2011, at 8:08 PM, Chris Idou wrote:
> I've noticed that Mac OS sometimes silently changes the UNIX mount name of
> network volumes. For example, if I mount a network volume of Media, it would
> normally be /Volumes/Media, but sometimes it isn't. For example, if another user
> on the same machine mounts Media first, then you might end up having it mounted
> as /Volumes/Media-1 or some such.
>
> Is there any document that discusses it? And what is the recommended way to
> store paths in this case? I don't know if its right, but I'm in the habit of
> storing UNIX paths, but this doesn't work very well for network shares because
> the UNIX path keeps changing because of the above. How can I store a path and
> get it back in a way that takes into account the above?
Best practice is to not store paths, but to store NSURL/CFURL bookmark data or, prior to 10.6, alias records. Whether or not those will work in the face of the volume path changes you note, I don't know, but they are probably your best bet. An alternative, just for network mounted volumes, would be to get the volume URL using FSCopyURLForVolume. (For local volumes, the URL is roughly equivalent to the file path and provides no additional information.)
> Also as an aside, is there a way to have network volumes mounted for all users
> at once instead of just one user at a time?
I don't recall the specifics, but I believe so if the volume is mounted at boot rather than during a user session. You can use fstab or the automount/autofs system to achieve this.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden