Re: Aliases with NDAlias not appearing where I tell them to be.
Re: Aliases with NDAlias not appearing where I tell them to be.
- Subject: Re: Aliases with NDAlias not appearing where I tell them to be.
- From: Fritz Anderson <email@hidden>
- Date: Wed, 27 Apr 2011 14:14:10 -0500
On 27 Apr 2011, at 1:40 PM, Kevin Muldoon wrote:
> NSString *aliasDirectory = [[NSHomeDirectory() stringByAppendingPathComponent: @"Desktop"] stringByExpandingTildeInPath];
> NSString *aliasName = @"ANewAliasTo_myFile.png";
> NSString *aliasPath = [aliasDirectory stringByAppendingPathComponent: aliasName];
>
> if( [[NDAlias aliasWithPath:filePath fromPath:aliasDirectory] writeToFile:aliasName] ) {
> NSLog(@"Create an alias for...\n\t %@", filePath);
> NSLog(@"And placed the alias here...\n\t %@", aliasPath);
> } else {
> NSLog(@"Alias file creation failed");
> }
Compare
[[NDAlias aliasWithPath:filePath fromPath:aliasDirectory] writeToFile: alias>>>Name<<<]
to
NSLog(@"And placed the alias here...\n\t %@", alias>>>Path<<<);
Also — though probably you're just doing it for the example — I don't recommend finding standard directories by concatenating literal strings. Pass the constant NSDesktopDirectory to NSSearchPathForDirectoriesInDomains().
— F
_______________________________________________
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