forked from wesnoth/wesnoth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapple_version.mm
65 lines (47 loc) · 1.68 KB
/
apple_version.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
Copyright (C) 2018 by Martin Hrubý <[email protected]>
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#ifdef __APPLE__
#include "apple_version.hpp"
#import "game_version.hpp"
#if defined(__APPLE__) && defined(__MACH__) && defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
#define __IPHONEOS__ (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000)
#endif
#import <Foundation/Foundation.h>
#if defined(__IPHONEOS__)
#import <UIKit/UIKit.h>
#endif
namespace desktop {
namespace apple {
std::string os_version() {
//
// Standard Apple version
//
std::string version_string = "";
NSArray *version_array = [[[NSProcessInfo processInfo] operatingSystemVersionString] componentsSeparatedByString:@" "];
#if defined(__IPHONEOS__)
std::string version_string = "iOS ";
#else
const version_info version_info([[version_array objectAtIndex:1] UTF8String]);
if (version_info.major_version() == 10 && version_info.minor_version() < 12) {
version_string = "Apple OS X ";
} else {
version_string = "Apple macOS ";
}
#endif
version_string += [[version_array objectAtIndex:1] UTF8String];
version_string += " (";
version_string += [[version_array objectAtIndex:3] UTF8String];
return version_string;
}
} // end namespace apple
} // end namespace desktop
#endif //end __APPLE__