Re: How to tell if a path is an Application
Re: How to tell if a path is an Application
- Subject: Re: How to tell if a path is an Application
- From: Ricky Sharp <email@hidden>
- Date: Fri, 17 Sep 2004 11:11:42 -0500
On Sep 17, 2004, at 10:13 AM, MT wrote:
How can I query if a path is an application?
I can use something like this
[[NSWorkspace sharedWorkspace] getInfoForFile:Path application:nil
type:&type];
if ([type isEqualToString:NSApplicationFileType]) {
.....
}
but this doesn't seem to work for non-Cocoa apps.
How can I also make it work for Carbon apps?
You could probably use Launch Services for this. Specifically, check
out the APIs in the LSInfo.h header from the LaunchServices framework.
Just a guess here as to the exact code, but I think you could start out
with an NSURL representing your path (which is the same as a CFURLRef).
Then, obtain an FSRef from the CFURLRef (see CFURLGetFSRef in
CFURL.h). Finally, call LSCopyItemInfoForRef to obtain an
LSItemInfoRecord struct. The flags field should then have the
kLSItemInfoIsApplication bit set if you have an app.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden