Re: NSFileManager - isExecutableFileAtPath - seems to lie
Re: NSFileManager - isExecutableFileAtPath - seems to lie
- Subject: Re: NSFileManager - isExecutableFileAtPath - seems to lie
- From: "Erik J. Barzeski" <email@hidden>
- Date: Sat, 06 Jul 2002 08:44:10 -0400
On 7/5/02 1:37pm, Diggory Laycock <email@hidden> wrote:
>
I was wondering if anyone else has noticed the somewhat unreliability of
>
NSFileManager's isExecutableFileAtPath: method.
>
>
It seems to return YES for *any bundle* (including frameworks) and
>
.webloc files.
>
>
It returns NO to aliases to Applications and to at least one specific
>
Carbon App (Sim Express (http://www.idexpress.fi/simexpress/))
>
>
>
Does anyone have any idea of how to accurately identify a path as an
>
application?
>
>
Digs.
You might want to try this:
- (BOOL)isFreakingApplication:(NSString*)path
{
LSItemInfoRecord infoRec;
LSCopyItemInfoForURL((CFURLRef)[NSURL fileURLWithPath: pathstr],
kLSRequestBasicFlagsOnly, &infoRec);
return infoRec.flags & kLSItemInfoIsApplication;
}
Works pretty well here.
--
Kindest regards,
Erik J. Barzeski
"Maybe fun is just fragments of existence with
Better packaging." - Apple CEO Steve Jobs, 1983
###################################################################
Email: erik@(anything below) AIM: iacas
http://iacas.org http://weims.net
http://techstra.net http://barzeski.com
http://cocoadevcentral.com http://soundsetcentral.com
http://freshlysqueezedsoftware.com http://applescriptcentral.com
###################################################################
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.