Professional Web Applications Themes

Identifying a folder as a package - Mac Programming

Dear All, I want to be able to check whether a folder is actually a package. I've looked at all the folder attributes and finder flags and even extended finder flags and I can't find what I need anywhere. There's a Cocoa command isFilePackageAtPath but this is a Carbon app... Help! Cheers Bill...

  1. #1

    Default Identifying a folder as a package

    Dear All,

    I want to be able to check whether a folder is actually a package.
    I've looked at all the folder attributes and finder flags and even
    extended finder flags and I can't find what I need anywhere. There's
    a Cocoa command isFilePackageAtPath but this is a Carbon app... Help!

    Cheers
    Bill
    Bill Guest

  2. #2

    Default Re: Identifying a folder as a package

    Bill Sellers wrote:
     

    Package folders are usually named .pkg, in fact if I rename a package folder
    ..foo and 'open' it, it opens as a folder in Finder instead of as a package
    in Installer. So I'd recommend sticking with the Apple way, and looking
    for folders named .pkg :-).

    The other way to do it would be to search for ./Contents/Archive.bom and
    ../Contents/Archive.pax.gz, which would be more foolproof but would make
    your app act differently to other Mac apps.
    --
    Graham Lee
    I am leeg, for we are many
    Java is the COBOL of the new millennium.
    http://users.ox.ac.uk/~wadh1342

    leeg Guest

  3. #3

    Default Re: Identifying a folder as a package

    In article <c1fn2g$p4j$ox.ac.uk>,
    leeg <physics.ox.ac.uk.valid> wrote:
     

    A package can be any doent that a program creates as a folder but
    wants the user to see as a single file, so this is not really true.
    Neither the file extension nor the contents will be fixed. The
    packagness of a folder seems to be determined by the application that
    'owns' the file, so I would guess (not having a lot of experience with
    Carbon) that this information might be available through LaunchServices.
    Michael Guest

  4. #4

    Default Re: Identifying a folder as a package

    Michael Ash wrote:
     
    >
    > A package can be any doent that a program creates as a folder but
    > wants the user to see as a single file, so this is not really true.
    > Neither the file extension nor the contents will be fixed. The
    > packagness of a folder seems to be determined by the application that
    > 'owns' the file, so I would guess (not having a lot of experience with
    > Carbon) that this information might be available through LaunchServices.[/ref]

    Oh, so we're including rtfds and apps as 'packages', not just pkgs. I
    thought we meant packages as in installer packages.

    Hmmm...speaking as a Mac programmer of UNIX extraction, I'd be inclined to
    treat directories as nature intended, i.e. as directories. But if you want
    to tell whether *any* arbitrary directory could *possibly* be a 'package',
    it sounds like there's going to quickly be an attack of specialcaseitis as
    some developer or other decides that his data is going to be stored in
    ..fubar directories, and some other developer decides he wants to store his
    data in .snafu directories, and so forth.
    --
    Graham Lee
    I am leeg, for we are many
    There are lies, damned lies, and call profile graphs.
    http://users.ox.ac.uk/~wadh1342

    leeg Guest

  5. #5

    Default Re: Identifying a folder as a package

    In article <google.com>,
    ac.uk (Bill Sellers) wrote:
     

    Call LSCopyItemInfoForRef and look at the kLSItemInfoIsPackage bit.

    hth

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  6. #6

    Default Re: Identifying a folder as a package

    In article <c1g0vm$bm$ox.ac.uk>,
    leeg <physics.ox.ac.uk.valid> wrote:
     

    It is obviously possible to do this in a general manner, because the
    Finder and every open/save dialog on the system understands it properly.
    Even something as simple as an RTFD doent created with TextEdit is a
    package. It makes sense to me that the Finder and open/save dialogs
    should treat these things as files most of the time. You won't have
    special cases; you simply check if anybody has declared that folders
    with such-and-such extension are actually a doent for his app and are
    a package. And since the system handles all of this, it's just a simple
    call for Bob Average Programmer to figure it out in his program.
    Michael Guest

Similar Threads

  1. Replies: 1
    Last Post: August 30th, 06:56 AM
  2. Identifying the Current URL
    By kenji776 in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: April 16th, 08:00 PM
  3. Picture package- printing entire folder on multiple pages
    By lkfarms in forum Adobe Photoshop Elements
    Replies: 7
    Last Post: August 13th, 02:17 AM
  4. Identifying spamhosts
    By Patrick Kirk in forum Debian
    Replies: 5
    Last Post: August 4th, 02:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139