
Signature
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
> > > > How to set directory bundle bit for a folder ?
> > >
[quoted text clipped - 4 lines]
> According to both Finder.h and SetFile --help, you can't set the bundle bit on a
> folder.
On my system, 'SetFile --help' doesn't say anything about that. The bit
is used to indicate 'packageness' - see
http://developer.apple.com/documentation/Carbon/Conceptual/carbon_porting_guide/
cpg_prepstruct/chapter_2_section_5.html#//apple_ref/doc/uid/TP30000991-CH202-BAB
BFHIH
"On Mac OS X, a bundle hierarchy normally appears as a single file,
unless the bundle bit is unset, in which case it appears as a folder
hierarchy."
> If you'd like to try anyway, here's some C++:
>
[quoted text clipped - 12 lines]
>
> I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
Ben Artin - 20 Jan 2006 23:15 GMT
> > > > > How to set directory bundle bit for a folder ?
> > > >
[quoted text clipped - 6 lines]
>
> On my system, 'SetFile --help' doesn't say anything about that.
You probably didn't read to the end:
Note: The following attributes may be used with the -a option:
A Alias file
B Bundle
C Custom icon*
D Desktop*
E Hidden extension*
I Inited*
M Shared (can run multiple times)
N No INIT resources
L Locked
S System (name locked)
T Stationery
V Invisible*
Z Busy*
Note: Items marked with an asterisk (*) are allowed with folders
But I agree with your interpretation of the bundle packaging documentation.
hth
Ben

Signature
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
toby - 20 Jan 2006 23:30 GMT
> > > > > > How to set directory bundle bit for a folder ?
> > > > >
[quoted text clipped - 8 lines]
>
> You probably didn't read to the end:
You're right :) My bad.
> Ben
>
[quoted text clipped - 3 lines]
>
> I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
> FSCatalogInfo info;
> ThrowIfOSError(::FSGetCatalogInfo(&folder, kFSCatInfoFinderInfo, &info, 0, 0,
[quoted text clipped - 3 lines]
> finderInfo.finderFlags |= kHasBundle;
> ThrowIfOSError(::FSSetCatalogInfo(& folder, kFSCatInfoFinderInfo, &info));
I think we're running into a terminology problem here:
-> In the Classic days (6.x - 9.x), there was a bundle resource ('BNDL')
that contained type <---> icon mappings. kHasBundle tells the Finder
that a file has a BNDL resource and it should scan it and add it to the
"desktop database".
-> In 9.x, Apple backported the concept of NeXT-style folder-based
applications, which NeXT called bundles, but Apple called packages. For
these packages, they introduced the package flag to the extended Finder
flags. SetFile() (mentioned by another poster) only accesses the
original Finder flags. You need to use FSSetCatalogInfo() and typecast
around a little to change the extended catalog info.
That said, I couldn't find the constant for the 'file package' flag in
the newest Carbon headers. Which isn't too surprising, as it isn't
really necessary on OS X anyway. If a folder has one of the known file
name extensions (.app, .bundle etc.) it is automatically checked whether
it's a bundle.
Is that maybe closer to what you're looking for?
Cheers,
-- Uli
http://www.zathras.de
toby - 21 Jan 2006 00:41 GMT
> > FSCatalogInfo info;
> > ThrowIfOSError(::FSGetCatalogInfo(&folder, kFSCatInfoFinderInfo, &info, 0, 0,
[quoted text clipped - 10 lines]
> that a file has a BNDL resource and it should scan it and add it to the
> "desktop database".
I never thought the OP was discussing this issue.
> -> In 9.x, Apple backported the concept of NeXT-style folder-based
> applications, which NeXT called bundles, but Apple called packages. For
> these packages, they introduced the package flag to the extended Finder
> flags. SetFile() (mentioned by another poster) only accesses the
> original Finder flags. You need to use FSSetCatalogInfo() and typecast
> around a little to change the extended catalog info.
SetFile utility does in fact change the relevant bit for folders,
signifying to Finder that they should be treated as packages. This is
simple to confirm.
> That said, I couldn't find the constant for the 'file package' flag in
> the newest Carbon headers. Which isn't too surprising, as it isn't
> really necessary on OS X anyway. If a folder has one of the known file
> name extensions (.app, .bundle etc.) it is automatically checked whether
> it's a bundle.
That is probably also a good way of achieving the same effect, but I'm
not sure if that works in the OS9 Finder (which also supports the idea
of folders-as-bundles/packages through the bundle bit).
> Is that maybe closer to what you're looking for?
>
> Cheers,
> -- Uli
> http://www.zathras.de
Chris Baum - 21 Jan 2006 03:25 GMT
> That is probably also a good way of achieving the same effect, but I'm
> not sure if that works in the OS9 Finder (which also supports the idea
> of folders-as-bundles/packages through the bundle bit).
As of OS 9.1, if a folder's name has an extension, contains a Contents
folder and the Contents folder contains a PkgInfo, the Finder considers
it a package (even if the bundle bit is not set).
abz - 21 Jan 2006 21:41 GMT
> > FSCatalogInfo info;
> > ThrowIfOSError(::FSGetCatalogInfo(&folder, kFSCatInfoFinderInfo, &info, 0, 0,
[quoted text clipped - 29 lines]
> -- Uli
> http://www.zathras.de
Add .bundle extension to the filename is just what I need.
Thank you.