• 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: Creating alias programatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating alias programatically


  • Subject: Re: Creating alias programatically
  • From: chaitanya pandit <email@hidden>
  • Date: Wed, 24 Sep 2008 02:34:17 +0530

Thanks for the input Ken,
Suppose the target file to which the symbolic link is pointing to is moved, is there any way one can determine where it was moved or deleted? Assuming the file was moved even when the app was not running?


On 24-Sep-08, at 2:10 AM, Ken Thomases wrote:

On Sep 23, 2008, at 2:13 PM, chaitanya pandit wrote:

I've been struggling with for quite a while now, what i want to achieve is create an alias of a folder at some location.

You may be being tripped up by terminology. An "alias" is an opaque data structure in memory. An "alias file" is a file on disk holding an alias in a specific format.


Apple has never officially supported applications creating alias files. In fact, the documentation often refers to them as "Finder alias files" because, as far as Apple is concerned, only the Finder should ever be creating them. See the section "Working With Finder Alias Files" in the Alias Manager Reference, and notice that there are only functions for examining and reading alias files, not creating them. For that reason, the supported way to create an alias file is to use Apple Events to ask the Finder to create it for you.


The alias would also be a folder like we have after creating an alias in the finder.

Alias files are never folders. As the name implies, alias files are always files. It is up to individual applications to notice when they are dealing with an alias file versus any other type of file, resolve the alias file if they want to know where it points, and present the alias file differently than a typical file if they so choose. In other words, the Finder is doing custom work to present an alias file which refers to a folder as though it were a folder. This doesn't come free from the system libraries as it would with Unix symbolic links.



say i have a folder "foo" in "/Users/me/Documents/foo" and i want to programatically create an alias of that folder on my desktop "/ Users/me/Desktop/fooalias"
how can i do that?

Google for "programmatically create alias file" and you should find sample code.


Cheers,
Ken


_______________________________________________

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: Creating alias programatically
      • From: Ken Thomases <email@hidden>
References: 
 >Creating alias programatically (From: chaitanya pandit <email@hidden>)
 >Re: Creating alias programatically (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Creating alias programatically
  • Next by Date: Re: Creating alias programatically
  • Previous by thread: Re: Creating alias programatically
  • Next by thread: Re: Creating alias programatically
  • Index(es):
    • Date
    • Thread