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: Kevin Muldoon <email@hidden>
- Date: Thu, 28 Apr 2011 14:05:46 -0400
FSNewAlias() huh? I'll take a look. So, you think I'm reversing the
'fromFile' parameter with 'aliasWithPath' ? That would be embarrassing!
Still, the example code shows the following...
NSString * kDirOfTestProject = @"~/Developer/Projects/NDAlias/"; // you need
to change this to the location of NDAlias
NSString * filePath = @"Test File.txt",
* folderPath = @"Test Folder",
* aliasFilePath = @"AliasFile";
testCreatingAliasFileFor( [[kDirOfTestProject stringByAppendingString:filePath]
stringByExpandingTildeInPath] );
void testCreatingAliasFileFor( NSString * aFilePath )
{
if( [[NDAlias aliasWithPath:aFilePath fromPath:NSHomeDirectory()]
writeToFile:aliasFilePath] )
{
printf("I have created an alias file for\n\t%s.\n", [aFilePath
fileSystemRepresentation]);
[[NSWorkspace sharedWorkspace] selectFile:aliasFilePath
inFileViewerRootedAtPath:@""];
}
else
{
printf("Alias file creation failed.\n");
}
}
or in other words..
The variable aFilePath passed into the function testCreatingAliasFileFor()
is clearly the full path of the file I want an alias of.
The NSHomeDirectory() at fromPath is clearly the path to the users home
directory.
The variable aliasFilePath (which should be renamed to something like
aliasFileName) is the name of the alias file that writeToFile needs,
apparently stringing fromPath of the method it's wrapped around.
Anyway, thanks for the rant! I very much appreciate a historical perspective
on things. I'll keep banging away it when time permits.
On Thu, Apr 28, 2011 at 9:54 AM, Sean McBride <email@hidden>wrote:
> On Wed, 27 Apr 2011 18:17:21 -0400, Kevin Muldoon said:
>
> >Alias file!
>
> I've not used NDAlias for alias files, only for alias records. I just
> looked at the example, and it does seems somewhat crusty. Still, I
> think you are misunderstanding the 'fromFile' parameter. Have you read
> Apple's docs for FSNewAlias()? That should clarify things. I'll be
> pushing a couple of minor fixes to the example regardless.
>
> >Just like one created when we option-drag files from one
> >directory to another in the Finder.
>
> Command-option-drag. :)
>
> >Yeah, I'd love to require 10.6 but
> >not a fit for our environment. Honestly, I'm perplexed this feature
> >hasn't already been packaged into the standard obj-c libraries until
> >just now.
>
> The standard conspiracy theory is because aliases come from Classic Mac
> OS, and the unix/Cocoa folks hated everything from there, that they were
> never added. Whatever the delay, they are finally in Cocoa as of 10.6.
> Mysteriously, they decided to switch from the term 'alias' to 'bookmark'
> despite the term alias being consistently used in both the UI and API
> since System 7 (and the term 'alias' persists in the UI, and the term
> 'bookmark' is already overloaded). Rant over. :)
>
> --
> ____________________________________________________________
> 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