Re: Finding os version at compile time and os version at runtime?
Re: Finding os version at compile time and os version at runtime?
- Subject: Re: Finding os version at compile time and os version at runtime?
- From: Rob Keniger <email@hidden>
- Date: Sun, 16 Dec 2007 23:15:18 +1100
On 16/12/2007, at 1:59 PM, Nik Youdale wrote:
The Gestalt function is a carbon function, so I guess it won't work
on leopard.
Both of these are actually not true, the Gestalt function is included
even if you just link against Cocoa/Cocoa.h and it definitely works on
Leopard.
You should actually use something like this to get the full OS version
number:
long majorVersion, minorVersion, bugFixVersion;
Gestalt(gestaltSystemVersionMajor, &majorVersion);
Gestalt(gestaltSystemVersionMinor, &minorVersion);
Gestalt(gestaltSystemVersionBugFix, &bugFixVersion);
NSLog(@"Running on Mac OS X %d.%d.
%d",majorVersion,minorVersion,bugFixVersion);
A lot of runtime checks broke when Apple released Mac OS X 10.4.10
because the bug fix version was assumed to be always a single digit.
Getting the individual version numbers as above will always work.
--
Rob Keniger
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden