Re: Getting the version of a non-bundle carbon application
Re: Getting the version of a non-bundle carbon application
- Subject: Re: Getting the version of a non-bundle carbon application
- From: "M. Uli Kusterer" <email@hidden>
- Date: Fri, 10 Oct 2003 14:57:13 +0200
At 11:23 Uhr -0700 09.10.2003, Devin Lane wrote:
I am making a program in which I need to get the version of
applications. For bundle applications, this is easy, as the
necessary information is stored in the info.plist file. However,
for non-bundle apps (like Resourcer), the version information is
stored in the resource forks. I have absolutely no idea how to use
resource forks, so I was wondering if anyone knows how this might be
done.
Use the Carbon Resource Manager APIs. If you're scared of Carbon, do
a Google for NDResourceFork, which is a nice wrapper class around
resources that returns them as NSData objects.
What you have to do is to look at 'vers' resources with ID 1 and 2
(or was it 0 and 1? I'll have to check that). The former is the
actual application version, the latter is known as the "package
version". Note that version numbers are stored as a NumVersion (which
is defined in some Carbon header). Basically, it's a two-byte hex
number, where the first byte is the main version, and the nibbles of
the second byte make up the minor revision and bugfix numbers. I.e.
10.2.8 would be 0x0A28. There's also info for the stage, i.e. whether
it's development, alpha, beta, or final.
The info on the details can probably gleaned from Carbon's headers
(my gut says "MacTypes.h" or "Resources.h") and the old Inside
Macintosh books, either the Finder Interface chapter in "Mac Toolbox
Essentials" or the chapter on the Resource Manager in "More Mac
Toolbox". It's a pretty simple resource if you're not scared of
packed P-strings.
Oh yeah: You may also run into 'plst' resources, which is simply a
.plist file stuffed in a resource. That'll probably be the easiest to
extract.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.