diff options
author | Mihai Moldovan <ionic@ionic.de> | 2016-09-26 08:49:56 +0200 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2016-09-25 23:49:56 -0700 |
commit | 49758cafba9fd7e0663b550debfd51fb21260650 (patch) | |
tree | bad9439a3a654cab55c9f3206af17c01ec04c3d1 /plugins | |
parent | 15600f405f2d5bda6ccf0dd73957395716e0d4d3 (diff) |
sysinfo: fix compilation on OS X 10.9 and lower. (#1821)
Use the (deprecated) Gestalt functionality for fetching the fine-grained OS X version number on 10.9 and lower. The newer NSOperatingSystemVersion structure is only available on 10.10+.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/sysinfo/osx/backend.m | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/sysinfo/osx/backend.m b/plugins/sysinfo/osx/backend.m index 450a557a..806e2d74 100644 --- a/plugins/sysinfo/osx/backend.m +++ b/plugins/sysinfo/osx/backend.m @@ -78,10 +78,22 @@ get_os (void) static char * get_os_fallback (void) { +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_9 + SInt32 ver_major = 0, + ver_minor = 0, + ver_patch = 0; + + Gestalt (gestaltSystemVersionMajor, &ver_major); + Gestalt (gestaltSystemVersionMinor, &ver_minor); + Gestalt (gestaltSystemVersionBugFix, &ver_patch); + + return g_strdup_printf ("OS X %d.%d.%d", ver_major, ver_minor, ver_patch); +#else NSProcessInfo *info = [NSProcessInfo processInfo]; NSOperatingSystemVersion version = [info operatingSystemVersion]; return g_strdup_printf ("OS X %ld.%ld.%ld", version.majorVersion, version.minorVersion, version.patchVersion); +#endif } char * sysinfo_backend_get_os(void) |