dealing with alias files, finding URL to target file

2011-04-15 Thread Sean McBride
Hi all, Of late, I've been working to remove NSString-based paths, FSRefs, and Alias Manager usage in my code, in favour of NSURL. But I'm having trouble with alias files. NSOpenPanel helpfully, by default, resolves aliases before it returns the URL to you. But NSPathControl does not and file

Re: dealing with alias files, finding URL to target file

2011-04-15 Thread Ken Thomases
On Apr 15, 2011, at 10:20 AM, Sean McBride wrote: Of late, I've been working to remove NSString-based paths, FSRefs, and Alias Manager usage in my code, in favour of NSURL. But I'm having trouble with alias files. NSOpenPanel helpfully, by default, resolves aliases before it returns the

Re: dealing with alias files, finding URL to target file

2011-04-15 Thread Mike Abdullah
On 15 Apr 2011, at 16:44, Ken Thomases wrote: On Apr 15, 2011, at 10:20 AM, Sean McBride wrote: Of late, I've been working to remove NSString-based paths, FSRefs, and Alias Manager usage in my code, in favour of NSURL. But I'm having trouble with alias files. NSOpenPanel helpfully, by

Re: dealing with alias files, finding URL to target file

2011-04-15 Thread Sean McBride
On Fri, 15 Apr 2011 10:44:06 -0500, Ken Thomases said: NSOpenPanel helpfully, by default, resolves aliases before it returns the URL to you. But NSPathControl does not and file drops that you get off NSPasteboard also do not. So in many cases I need to manually check if a URL points to an

Re: dealing with alias files, finding URL to target file

2011-04-15 Thread Ken Thomases
On Apr 15, 2011, at 11:16 AM, Sean McBride wrote: On Fri, 15 Apr 2011 10:44:06 -0500, Ken Thomases said: Yes. Bookmark data is the modern replacement for alias records. The new bookmark APIs are backward compatible with aliases, including alias files. See the documentation for +[NSURL

Re: dealing with alias files, finding URL to target file

2011-04-15 Thread Sean McBride
On Fri, 15 Apr 2011 11:22:45 -0500, Ken Thomases said: Yes. Bookmark data is the modern replacement for alias records. The new bookmark APIs are backward compatible with aliases, including alias files. See the documentation for +[NSURL bookmarkDataWithContentsOfURL:error:]. You'd follow

Re: dealing with alias files, finding URL to target file

2011-04-15 Thread Quincey Morris
On Apr 15, 2011, at 11:10, Sean McBride wrote: _this_ is a PITA: - (NSURL*)URLByResolvingSymlinksAndAliases { NSURL* resultURL = [self URLByResolvingSymlinksInPath]; NSError* error = nil; NSNumber* isAliasFile = nil; BOOL success = [resultURL

Re: dealing with alias files, finding URL to target file

2011-04-15 Thread Sean McBride
On Fri, 15 Apr 2011 12:01:14 -0700, Quincey Morris said: I'll ask the dumb question: what happens if you invoke bookmarkDataWithContentsOfURL on a non-alias file? If it correctly detects an error, your PITA code could be reduced to: I thought about that, the docs say: /* Given the url of a file