From 35277443e4486b7fe875b0ca167cddb4cfeacdc4 Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 29 Oct 2020 12:48:14 +0000 Subject: [PATCH] SystemStats: Use new dictionaryWithContentsOfURL signature --- .../juce_core/native/juce_mac_SystemStats.mm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/juce_core/native/juce_mac_SystemStats.mm b/modules/juce_core/native/juce_mac_SystemStats.mm index 9665260ed1..202896a51f 100644 --- a/modules/juce_core/native/juce_mac_SystemStats.mm +++ b/modules/juce_core/native/juce_mac_SystemStats.mm @@ -121,10 +121,21 @@ static String getOSXVersion() { JUCE_AUTORELEASEPOOL { - NSDictionary* dict = [NSDictionary dictionaryWithContentsOfFile: - nsStringLiteral ("/System/Library/CoreServices/SystemVersion.plist")]; + const String systemVersionPlist ("/System/Library/CoreServices/SystemVersion.plist"); - return nsStringToJuce ([dict objectForKey: nsStringLiteral ("ProductVersion")]); + #if (defined (MAC_OS_X_VERSION_10_13) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_13) + NSError* error = nullptr; + NSDictionary* dict = [NSDictionary dictionaryWithContentsOfURL: createNSURLFromFile (systemVersionPlist) + error: &error]; + #else + NSDictionary* dict = [NSDictionary dictionaryWithContentsOfFile: juceStringToNS (systemVersionPlist)]; + #endif + + if (dict != nullptr) + return nsStringToJuce (dict[nsStringLiteral ("ProductVersion")]); + + jassertfalse; + return {}; } } #endif