I hope some of you NDAlias users can lend a hand. Everything in the code looks right and everything in the Console looks right but instead of creating an alias on the Desktop, the alias is created next to the compiled program in the xcode project folder.



#import <Cocoa/Cocoa.h>
#import "Alias.h"

int main (int argc, const char * argv[]) {
                
        NSAutoreleasePool               *pool = [[NSAutoreleasePool alloc] 
init];
        
        NSString *fileDirectory                 =               
@"~/Documents/DustBin/20110322/152223/";
        NSString *fileName                      =               @"myFile.png";
NSString *filePath = [[fileDirectory stringByAppendingString:fileName] stringByExpandingTildeInPath]; 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");
        }
                
        [pool release];
        return 0;
}


The Debugger has exited with status 0.
[Session started at 2011-04-27 14:32:46 -0400.]
2011-04-27 14:32:46.261 NDAliasesURLProject[3514:10b] Create an alias for...
         /Users/kevin/Documents/DustBin/20110322/152223/myFile.png
2011-04-27 14:32:46.263 NDAliasesURLProject[3514:10b] And placed the alias here...
         /Users/kevin/Desktop/ANewAliasToMyFile.png
_______________________________________________

Cocoa-dev mailing list ([email protected])

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