Re: operatingSystemVersionString replacement
Re: operatingSystemVersionString replacement
- Subject: Re: operatingSystemVersionString replacement
- From: Sean McBride <email@hidden>
- Date: Fri, 25 Oct 2013 11:53:01 -0400
- Organization: Rogue Research Inc.
On Fri, 25 Oct 2013 06:02:23 -0700, Gary L. Wade said:
>Not to say using the OS version number is right in your case, but when I
>need a parseable OS version number without relying upon Gestalt, I get the
>ProductVersion key from /System/Library/CoreServices/SystemVersion.plist
>and parse that into an NSIndexPath, which works great with encapsulating
>10.8.5, 10.9, 10.7.5.12, etc.
I agree with others that NSAppKitVersionNumber and friends are usually preferable, but sometimes it is useful/required to get the actual numbers "10", "8", and "5" in a parseable/non-localized way. Parsing uname results is fragile. operatingSystemVersionString is localized. Assuming /System/Library/CoreServices/SystemVersion.plist will always be at that path is fragile. Can you even read it when sandboxed?
Gestalt(), despite being deprecated, is the safest way:
Gestalt (gestaltSystemVersionMajor, &major);
Gestalt (gestaltSystemVersionMinor, &minor);
Gestalt (gestaltSystemVersionBugFix, &fix);
IMHO, it was deprecated prematurely, without a replacement for uses like this.
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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