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                 s...@rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to