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

This email sent to [EMAIL PROTECTED]

Reply via email to