Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > How to detect if a directory is a package?

How to detect if a directory is a package?
Thread Tools
Mac Enthusiast
Join Date: Jun 2000
Location: New Jersey, USA
Status: Offline
Reply With Quote
Jul 17, 2003, 09:00 AM
 
From the shell, packages seem to just look like ordinary directories. Where/how is it indicated that the directory is in fact a package?
     
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Jul 17, 2003, 09:58 AM
 
Originally posted by neilw:
From the shell, packages seem to just look like ordinary directories. Where/how is it indicated that the directory is in fact a package?
usually "packages" have special extensions like ".app" etc.
     
Forum Regular
Join Date: Jun 2001
Location: On the move again...
Status: Offline
Reply With Quote
Jul 17, 2003, 10:42 AM
 
Originally posted by neilw:
From the shell, packages seem to just look like ordinary directories. Where/how is it indicated that the directory is in fact a package?
Well, they are just directories

Usually (always, I think) though, if you cd into them, there will be a Contents directory, which will have a file " PkgInfo". Other than that, from the file system's point of view, they are just directories.
     
neilw  (op)
Mac Enthusiast
Join Date: Jun 2000
Location: New Jersey, USA
Status: Offline
Reply With Quote
Jul 17, 2003, 11:40 AM
 
Well, looking at a Konfabulator widget I wrote, it has no Pkginfo or info.plist or anything, but it is still recognized by the Finder as a package (or a bundle, maybe that's the correct term?).

I created it by editing a pre-existing package, so I don't know what the magic was that made it a package in the first place.

I'm thinking now that this is more of an OSX question than a UNIX one per se...
     
Forum Regular
Join Date: Jun 2001
Location: On the move again...
Status: Offline
Reply With Quote
Jul 17, 2003, 01:07 PM
 
Originally posted by neilw:
Well, looking at a Konfabulator widget I wrote, it has no Pkginfo or info.plist or anything, but it is still recognized by the Finder as a package (or a bundle, maybe that's the correct term?).

I created it by editing a pre-existing package, so I don't know what the magic was that made it a package in the first place.

I'm thinking now that this is more of an OSX question than a UNIX one per se...
arstechnica says it is a meta-information feature, so that would be why the terminal can't distinguish it.
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jul 17, 2003, 03:09 PM
 
1) Create a folder "test.app"
2) Create a folder inside called "Contents"
3) Get Info on the folder. It says "Classic Application"
4) Add a MacOS folder, containing the binary
5) Add a Info.plist file referencing the binary
6) You now have a bundle.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Jul 17, 2003, 03:22 PM
 
Originally posted by Arkham_c:
1) Create a folder "test.app"
2) Create a folder inside called "Contents"
3) Get Info on the folder. It says "Classic Application"
4) Add a MacOS folder, containing the binary
5) Add a Info.plist file referencing the binary
6) You now have a bundle.
Just name it "test.app" and it'll say Classic Application... double click it and it tries to launch... aahahah.
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
neilw  (op)
Mac Enthusiast
Join Date: Jun 2000
Location: New Jersey, USA
Status: Offline
Reply With Quote
Jul 18, 2003, 09:30 AM
 
Ah, I think I understand now. The extension ".app" is registered with the system (wherever such things go) as indicating a bundle, probably by the Finder.

So is the ".widget" extension, which I assume is done by Konfabulator when it is installed. I tried just naming a folder test.widget and sure enough it shows up as a bundle in the finder.

So that means there's nothing actually inside the bundle to indicate its existence other than the extension.

That would imply that there is no easy way to detect a bundle from the shell unless it is possible to read the list of extensions that indicate bundles. I'm guessing that's not gonna happen without more pain than I care to self-inflict.

Oh well, I learned something. Thanks!

[edit] Wait a minute, this doesn't explain why some ".ape" modules are shown as bundles (cleardock.ape) and some are not (windowshade X.ape). Same extension, same folder, shown differently in the finder. Anyone have any ideas on this one?
     
Dedicated MacNNer
Join Date: May 2002
Status: Offline
Reply With Quote
Jul 18, 2003, 07:05 PM
 
First of all the finder treats the .app extension
diffrently, thats why when you turn on
always show extension you still dont see
the .apps. Secondly you can turn any
folder into a bundel into a folder and any
bunddel into a folder. Remember bundel
first aid in os 9 that would turn bundels
that became folders back into folders.

I think (I said I think ) It is some kind
of meta-data that is handeled similarly
to comments, labels, locks etc..
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:09 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2