• 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: Testing if a folder is a bundle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testing if a folder is a bundle


  • Subject: Re: Testing if a folder is a bundle
  • From: Chris Boot <email@hidden>
  • Date: Mon, 27 Aug 2001 01:20:04 +0200

Hi,

> At 7:39 PM +0200 8/26/2001, Chris Boot wrote:
>> I've been trying to programmatically test whether a certain folder is a
>> bundle, with no success. I've tried creating a CFBundleRef from an NSURL
>> (I'm writing a Cocoa app) cast to a CFURLRef (this is valid), but
>> CFBundleCreate just happily creates bundles for folders which quite
>> obviously are NOT bundles. I've also tried getting the folder's finder
>> flags and testing for the bundle bit (which works on Mac OS 9, AFAIK), but
>> that doesn't work.
>>
>> Is there a way of programmatically telling whether a folder should be
>> treated like a file? How does the Finder do it?
>
> Use LaunchServices. You can call LSCopyItemInfoForURL or the FSRef
> variant, checking to see if the kLSItemInfoIsPackage bit is set in
> the resulting item info struct's flags.

This is what I went with, as it also provides me with other flags and type
and creator information, which is just what I want.

Many thanks to all those who helped.

Best wishes,

--
.-. Chris Boot
/v\ email@hidden
// \\
/( )\ L I N U X
^^-^^ >Phear the Penguin<


  • Prev by Date: Re: QT/OpenGL (Re: was Potential O'Reilly Cocoa books (was Docs))
  • Next by Date: Re: [NEWBIE] Re: Docs, questions and stuff
  • Previous by thread: Re: Testing if a folder is a bundle
  • Next by thread: Re: Testing if a folder is a bundle
  • Index(es):
    • Date
    • Thread