• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Converting an afp:NSURL to a filesystem path - or - Ya can't get there from here...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Converting an afp:NSURL to a filesystem path - or - Ya can't get there from here...


  • Subject: Converting an afp:NSURL to a filesystem path - or - Ya can't get there from here...
  • From: James Bucanek <email@hidden>
  • Date: Sat, 17 Apr 2010 16:46:36 -0700

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 Bucanek@March Hare._afpovertcp._tcp.local/Dinah)
    NSDevicePath = "/Dinah"

The path "/Dinah" is (obviously) invalid.

Here's what I've tried:
-[NSURL path]: Doesn't work (returns "/Dinah")
-[NSURL filePathURL]: Doesn't work (returns nil)
-[NSURL resourceValuesForKeys:error:] and -[NSURL getResourceValue:forKey:error:]: I can't find any keys that return anything useful. Specifically, NSURLVolumeURLKey doesn't return anything.


So that's what has me stumped at the moment. This can't be done, I'm missing something blindly obvious, or it's a bug--possibly some combination.



_______________________________________________

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


  • Follow-Ups:
    • Re: Converting an afp:NSURL to a filesystem path - or - Ya can't get there from here...
      • From: Ken Thomases <email@hidden>
    • Re: Converting an afp:NSURL to a filesystem path - or - Ya can't get there from here...
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Zeroing out instance variables
  • Next by Date: Re: Converting an afp:NSURL to a filesystem path - or - Ya can't get there from here...
  • Previous by thread: Re: Baffling Button Behavior [SOLVED]
  • Next by thread: Re: Converting an afp:NSURL to a filesystem path - or - Ya can't get there from here...
  • Index(es):
    • Date
    • Thread