From 3796744dacfc72610a8dc74e699ee5387adf2123 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Thu, 20 Aug 2015 16:16:45 +0200 Subject: [PATCH] Include OS X name in wxGetOsDescription(). Use the marketing/code name of the current OS X version (if known) as part of the wxGetOsDescription(). Also removed the Mac prefix in the description which is no longer used since OS X 10.8. --- src/osx/cocoa/utils.mm | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 46459586a3..78cd165708 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -677,9 +677,45 @@ bool wxCheckOsVersion(int majorVsn, int minorVsn) wxString wxGetOsDescription() { - NSString* osDesc = [NSProcessInfo processInfo].operatingSystemVersionString; - return wxString::Format("%s %s", _("Mac OS X"), wxCFStringRef::AsString(osDesc)); + int majorVer, minorVer; + wxGetOsVersion(&majorVer, &minorVer); + + wxString osBrand = _("OS X"); + wxString osName; + if (majorVer == 10) + { + switch (minorVer) + { + case 7: + osName = _("Lion"); + // 10.7 was the last version where the "Mac" prefix was used + osBrand = _("Mac OS X"); + break; + case 8: + osName = _("Mountain Lion"); + break; + case 9: + osName = _("Mavericks"); + break; + case 10: + osName = _("Yosemite"); + break; + case 11: + osName = _("El Capitan"); + break; + }; + } + + wxString osDesc = osBrand; + if (!osName.empty()) + osDesc += " " + osName; + + NSString* osVersionString = [NSProcessInfo processInfo].operatingSystemVersionString; + if (osVersionString) + osDesc += " " + wxCFStringRef::AsString(osVersionString); + + return osDesc; } #endif // wxOSX_USE_COCOA