Re: Bookmark alias files v. Finder alias files
Re: Bookmark alias files v. Finder alias files
- Subject: Re: Bookmark alias files v. Finder alias files
- From: Charles Srstka <email@hidden>
- Date: Sat, 14 Apr 2012 12:26:04 -0500
On Apr 13, 2012, at 6:54 PM, Shane Stanley wrote:
> I'm creating alias files using bookmark data, as in the docs:
>
> NSData *bookmarkData = [url bookmarkDataWithOptions:NSURLBookmarkCreationSuitableForBookmarkFile
> includingResourceValuesForKeys:nil
> relativeToURL:nil
> error:&error];
>
> [NSURL writeBookmarkData:bookmarkData toURL:bookmarkURL options:0 error:&error];
>
> When I look in the Finder, a Finder-created alias of the same file is listed as 144KB, while the one I saved is 96KB. I'm curious about what's in that extra 48KB.
I decided to have a look at this, so I created a couple of aliases to an empty folder, one from the Finder and one from NSURL. Just as you found, the Finder alias’s resource fork is larger than the NSURL alias’s. The ‘alis’ resources for both are the same size; however, the NSURL-created alias contains an ‘icns’ resource with ID -16496 storing the icon of the file to which the alias points, and the Finder has *two* such ‘icns’ resources; one with ID -16496 and one with ID -16455. The two ‘icns’ resources appear to be identical, and if I subtract the size of one of them from the Finder alias’s size, I get the size of the NSURL-created alias. So I’d guess that the duplicate icon resources are the reason for the discrepancy you’re seeing, and the alias files you’re creating with NSURL aren’t lacking any important information.
Charles
_______________________________________________
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