On Apr 17, 2010, at 6:46 PM, James Bucanek wrote: > How do I get the mount point path of a freshly mounted volume in Snow Leopard? > > In Leopard (10.5), the NSWorkspaceDidMountNotification included an > NSDevicePath value. It contained the path to the mount point of the freshly > mounted volume. > > In Snow Leopard (10.6), this property has been deprecated and has been > replaced with NSWorkspaceVolumeURLKey that contains an NSURL to the new > volume. > > Here's the problem: How do you turn the NSURL into its equivalent filesystem > path? > > For backwards compatibility, the notification still includes an NSDevicePath > value, but that value is wrong for AFP volumes. For example, in 10.5 mounting > the network volume "Dinah" would fire a notification containing > NSDevicePath="/Volumes/Dinah". In 10.6, mounting the same volume posts a > notification containing: > > NSWorkspaceVolumeURLKey = > NSURL(afp://james%20buca...@march%20hare._afpovertcp._tcp.local/Dinah) > NSDevicePath = "/Dinah"
Does seem like a bug. Perhaps you can use -[NSWorkspace mountedLocalVolumePaths]? You'd keep a copy of the old value and recheck it on each mount/unmount notification. By the way, are you mounting this volume programmatically using FSMountServerVolumeSync/Async? If so, then you get a volume reference number back, and you can use FSGetVolumeInfo to get its root directory as an FSRef, and from there a path or URL. In fact, it may be possible to use FSMountServerVolumeSync with the afp: URL you're getting from NSWorkspace. You'd effectively be asking to remount the volume that was just mounted. Hopefully, the OS will immediately return success without doing any actual new mounting, and that would be a way to get the volume reference number. On the other hand, it's just as likely to return some sort of "volume already mounted" error. Good luck, Ken _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
