This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

source: ps/trunk/source/lib/sysdep/os/osx/osx_sys_version.mm

Last change on this file was 20530, checked in by wraitii, 7 years ago

Fix OSX compilation

A check for OSX version that seemed useless broke compilation on Xcode 9.

Reviewed By: Itms

Differential Revision: https://code.wildfiregames.com/D986

  • Property svn:eol-style set to native
File size: 2.4 KB
RevLine 
[19899]1/* Copyright (C) 2013 Wildfire Games.
[13821]2 *
3 * Permission is hereby granted, free of charge, to any person obtaining
4 * a copy of this software and associated documentation files (the
5 * "Software"), to deal in the Software without restriction, including
6 * without limitation the rights to use, copy, modify, merge, publish,
7 * distribute, sublicense, and/or sell copies of the Software, and to
8 * permit persons to whom the Software is furnished to do so, subject to
9 * the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#import <AvailabilityMacros.h> // MAC_OS_X_VERSION_MIN_REQUIRED
24#import <Foundation/Foundation.h>
[14140]25#import <dispatch/dispatch.h>
[13821]26#import <string>
27
[14140]28#import "osx_sys_version.h"
[13821]29
[14140]30void GetSystemVersion(int &major, int &minor, int &bugfix)
[13821]31{
[14140]32 // grand central dispatch only available on 10.6+
33#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
34 if (dispatch_once != nil)
35 {
36 // sensible default
37 static int mMajor = 10;
38 static int mMinor = 8;
39 static int mBugfix = 0;
[13821]40
[14140]41 static dispatch_once_t onceToken;
42 dispatch_once(&onceToken, ^{
43 NSString* versionString = [[NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"] objectForKey:@"ProductVersion"];
44 NSArray* versions = [versionString componentsSeparatedByString:@"."];
[20530]45
[14140]46 if (versions.count >= 1)
47 mMajor = [[versions objectAtIndex:0] integerValue];
48 if (versions.count >= 2)
49 mMinor = [[versions objectAtIndex:1] integerValue];
50 if (versions.count >= 3)
51 mBugfix = [[versions objectAtIndex:2] integerValue];
52 });
[13821]53
[14140]54 major = mMajor;
55 minor = mMinor;
56 bugfix = mBugfix;
57 }
58 else
59 {
60#endif // fallback to 10.5 API
61 // just return 10.5.0, it's unlikely we support an earlier OS
62 // and unlikely we care about bugfix versions
63 major = 10;
64 minor = 5;
65 bugfix = 0;
66#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
67 }
68#endif
[13821]69}
Note: See TracBrowser for help on using the repository browser.