On Aug 22, 2012, at 7:14 PM, Graham Cox <graham....@bigpond.com> wrote:
> Turns out the problem I was having with this is because of the behaviour of 
> [NSURL fileURLWithPath:isDirectory:].
> 
> When I passed the path to the iPhoto database file (~/Pictures/iPhoto 
> Library/Album.xml) the resulting URL was bizarrely altered to point to some 
> non-existent path within my sandbox. In fact it looks like a bug because it 
> ended up concatenating 'file://' somewhere in the middle of the path which 
> makes no sense.

>From the +fileURLWithPath:isDirectory: documentation:
"If path begins with a tilde, it must first be expanded with 
stringByExpandingTildeInPath."

Note also that paths with '~' in them are treated differently in sandboxed apps.


> Instead, I used [NSURL URLWithString:] and it works correctly.

Don't do that. +URLWithString: expects a string that represents a URL, not a 
string that represents a filesystem path.


-- 
Greg Parker     gpar...@apple.com     Runtime Wrangler



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to