When this application starts, the delegate will receive application:openFile: If this made you start, application:openFile: will be between applicationWillFinishLaunching: and applicationDidFinishLaunching: You can get application:openFile: at another time, since you may have already been started when the user double-clicks the document.
EDIT: aliases are now called bookmarks (since 10.6). You are using NSURL to read them. See the File System Programming Guide for more information, but here is a quick example:
NSURL *aliasURL = [NSURL fileURLWithPath:@"..."]; NSData *alias = [NSURL bookmarkDataWithContentsOfURL:aliasURL error:&error]; if (alias == NULL) { NSLog(@"Failed aliasURL: %@", error); } BOOL isStale; NSURL *realURL = [NSURL URLByResolvingBookmarkData:alias options:0 relativeToURL:nil bookmarkDataIsStale:&isStale error:&error]; if (isStale || realURL == NULL) { NSLog(@"Failed realURL: %@", error); } NSLog(@"realPath:%@", [realURL path]);
I do not know a single API that will tell you that this NSURL is an alias other than reading it as one and seeing if it works.
Keep in mind that users can also create the same situation using symbolic links.
source share