• 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
Re: dealing with alias files, finding URL to target file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: dealing with alias files, finding URL to target file
  • From: Sean McBride <email@hidden>
  • Date: Fri, 15 Apr 2011 12:16:38 -0400
  • Organization: Rogue Research Inc.

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 alias file, and find the file it points to.  Am I
>> missing an easy/modern way to do this?
>
>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 that with -
>URLByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:.

Yeah, that works, but is not easy.

I find it quite strange that there is a URLByResolvingSymlinksInPath
method, but no corresponding method to change a URL to an alias file
into a URL to the target file.  Seems this is a common operation, much
more so than doing the same with symlinks.  The Mac GUI doesn't even let
users create symlinks, but does let them create alias files.

I was hoping I missed something.... but I guess not.

Cheers!

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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: dealing with alias files, finding URL to target file
      • From: Ken Thomases <email@hidden>
References: 
 >dealing with alias files, finding URL to target file (From: Sean McBride <email@hidden>)
 >Re: dealing with alias files, finding URL to target file (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: dealing with alias files, finding URL to target file
  • Next by Date: Re: Error validating email addresses in Core Data
  • Previous by thread: Re: dealing with alias files, finding URL to target file
  • Next by thread: Re: dealing with alias files, finding URL to target file
  • Index(es):
    • Date
    • Thread