Skip to content

Commit

Permalink
SystemStats: Use new dictionaryWithContentsOfURL signature
Browse files Browse the repository at this point in the history
  • Loading branch information
reuk committed Oct 29, 2020
1 parent 4fd3dfb commit 3527744
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions modules/juce_core/native/juce_mac_SystemStats.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3527744

Please sign in to comment.