From 49758cafba9fd7e0663b550debfd51fb21260650 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Mon, 26 Sep 2016 08:49:56 +0200 Subject: 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+. --- plugins/sysinfo/osx/backend.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugins/sysinfo') 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) -- cgit 1.4.1