Right way to check system version?
Right way to check system version?
- Subject: Right way to check system version?
- From: Ron Fleckner <email@hidden>
- Date: Fri, 19 May 2006 17:47:04 +1000
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:
// See if we're running on Jaguar:
NSString *sysVersionPlistPath = @"/System/Library/CoreServices/
SystemVersion.plist";
NSFileManager *fm = [NSFileManager defaultManager];
if ([fm fileExistsAtPath:sysVersionPlistPath])
{
NSDictionary *sysPlistDict = [NSDictionary
dictionaryWithContentsOfFile:sysVersionPlistPath];
NSString *prodVers = [sysPlistDict objectForKey:@"ProductVersion"];
NSScanner *versionScan = [NSScanner scannerWithString:prodVers];
float version;
[versionScan scanFloat:&version];
if (version < 10.3)
[self setIsJaguar:YES];
else
[self setIsJaguar:NO];
} else {
[self setIsJaguar:NO];
}
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.
I don't know any Cocoa programmers so that's why I'm asking here.
Thanks in advance,
Ron Fleckner
_______________________________________________
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