Re: Right way to check system version?
Re: Right way to check system version?
- Subject: Re: Right way to check system version?
- From: Chris Ridd <email@hidden>
- Date: Fri, 19 May 2006 14:05:08 +0100
- Thread-topic: Right way to check system version?
On 19/5/06 1:00, Steve Checkoway <email@hidden> wrote:
>
> On May 19, 2006, at 12:47 AM, Ron Fleckner wrote:
>
>> Hi,
>>
>> I was wondering whether this was a good enough way to see what
>> system my app is running on. I need to see if it's running on
>> Jaguar to decide whether to set up a particular UI widget, because
>> I know it won't work properly on Jaguar.
>>
>> Here's what I did:
>> ...
>> I'd like to think there is a simpler, more direct way. I looked at
>> Gestalt in the docs, but found this at the end of the section about
>> System Version Selector:
>>
>>> A better way to obtain version information in Mac OS X is to read
>>> the system version information from the following file:
>>>
>>> /System/Library/CoreServices/SystemVersion.plist
>>>
>>> Never infer the existence of certain hardware or software features
>>> from the responses that Gestalt returns when you pass it this
>>> selector.
> int main()
> {
> OSErr err;
> long code;
> /* Get system version */
> err = Gestalt( gestaltSystemVersion, &code );
> if( err == noErr )
> {
> int major = ( (code >> 12) & 0xF ) * 10 + (code >> 8) & 0xF;
> int minor = (code >> 4) & 0xF;
> int revision = code & 0xF;
>
> printf( "Mac OS X %d.%d.%d\n", major, minor, revision );
> }
> return 0;
> }
Wouldn't it be better to check the Appkit version instead? See the "Runtime
Version Check" section in the AppKit release notes.
Assuming you knew which versions of the AppKit contained that particular
bug, of course.
Cheers,
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden