• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to tell if a path is an Application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >How to tell if a path is an Application (From: MT <email@hidden>)

  • Prev by Date: Re: The invisible file in Macintosh?
  • Next by Date: Re: How to tell if a path is an Application
  • Previous by thread: How to tell if a path is an Application
  • Next by thread: Re: How to tell if a path is an Application
  • Index(es):
    • Date
    • Thread