On Fri, 16 Sep 2011 19:14:35 +0800, Rick C. said:
>This might seem a bit outdated but it's useful for my work...regarding
>old ppc apps (I'm assuming ppc but could be classic) there are some that
>are not bundles and also they do not carry the .app extension. However
>in Finder they do show Application under the Kind field. My question
>would be how can I confirm these as apps via code? Since they are not
>bundles and they do not carry the .app extension I'm not quite sure. Thanks!
Here's an NSURL category method that tests if the receiver conforms to a given
URL. You could use it with kUTTypeApplication.
- (BOOL)doesConformToUTI:(CFStringRef)inUTI
{
Boolean conforms = false;
NSError* error = nil;
NSString* fileUTI = nil;
BOOL success = [self getResourceValue:&fileUTI
forKey:NSURLTypeIdentifierKey
error:&error];
if (success && fileUTI)
{
conforms = UTTypeConformsTo ((CFStringRef)fileUTI, inUTI);
}
return (conforms ? YES : NO);
}
--
____________________________________________________________
Sean McBride, B. Eng [email protected]
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]