Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
- Subject: Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
- From: Ken Thomases <email@hidden>
- Date: Mon, 7 Apr 2008 22:30:10 -0500
On Apr 7, 2008, at 10:11 PM, Mike wrote:
I need to get the creator code of my app's bundle without diving
into the bundle and reading the plist directly.
[... snip ...]
The problem is, fileHFSCreatorCode on the returned attributes
dictionary always returns 0 or an empty OSType. Is there some other
method I need to use to get the creator of bundled apps instead of
files?
I think the problem is that fileAttributesAtPath:... operates at a
low level. It's actually providing the attributes of the application
bundle's directory, and directories don't have creator codes.
However, you need not dive into the bundle and read the plist
directly -- you can let the framework do that for you. It would be
something like:
[[[NSBundle bundleWithPath:enumeratedItem] infoDictionary]
objectForKey:@"CFBundleSignature"]
I haven't tested, but it might also be that the LSCopyItemAttribute
function with the kLSItemFileCreator attribute name would return the
creator code for an application when passed the FSRef for the bundle.
Cheers,
Ken
_______________________________________________
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