Re: operatingSystemVersionString replacement
Re: operatingSystemVersionString replacement
- Subject: Re: operatingSystemVersionString replacement
- From: August Mueller <email@hidden>
- Date: Fri, 25 Oct 2013 22:15:30 -0500
On Oct 25, 2013, at 10:53 AM, Sean McBride <email@hidden> wrote:
> 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.
Here's a little Gestalt replacement I wrote for myself a while back:
https://gist.github.com/ccgus/6384865
It uses SystemVersion.plist, but I'm pretty that's not going to be moved around anytime soon.
-gus
_______________________________________________
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