Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
- Subject: Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
- From: Steve Christensen <email@hidden>
- Date: Tue, 8 Apr 2008 10:02:49 -0700
On Apr 7, 2008, at 10:03 PM, Jens Alfke wrote:
On 7 Apr '08, at 8: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.
You're mixing up HFS creator codes with bundle identifiers, I think.
HFS creator codes are attributes of document files that identify
what app created them. They're 4-character codes like 'ttxt'.
They're not used much anymore in OS X, partly because most
filesystems don't support them. (Even if your app defines one, you
won't find any files inside the bundle with that creator code. It's
stored as a key in the Info.plist.)
Bundle identifiers look like "com.mycompany.MyApp" and are used to
identify applications in OS X. To get your app's bundle identifier,
use the NSBundle snippet someone already posted.
Although if, for some reason, the OP is looking for the "classic"
type and creator values (4-character OSType), you can also get them
directly using CF:
void GetBundleTypeCreator(CFURLRef bundleURL, OSType& bundleType,
OSType& bundleCreator)
{
bundleType = 0;
bundleCreator = 0;
CFBundleRef bundle = CFBundleCreate(kCFAllocatorDefault,
bundleURL);
if (bundle != NULL)
{
CFBundleGetPackageInfo(bundle, &bundleType, &bundleCreator);
CFRelease(bundle);
}
}
_______________________________________________
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