Fix #6383: macOS deprecation errors when compiling.

This commit is contained in:
Aaron van Geffen 2017-10-06 01:46:23 +02:00 committed by Michael Steenbeek
parent 4224193d68
commit 0217734c4e
2 changed files with 4 additions and 2 deletions

View File

@ -36,6 +36,7 @@
- Improved: [#6186] Transparent menu items now draw properly in OpenGL mode. - Improved: [#6186] Transparent menu items now draw properly in OpenGL mode.
- Improved: [#6218] Speed up game start up time by saving scenario index to file. - Improved: [#6218] Speed up game start up time by saving scenario index to file.
- Improved: Load/save window now refreshes list if native file dialog is closed/cancelled. - Improved: Load/save window now refreshes list if native file dialog is closed/cancelled.
- Technical: [#6384] On macOS, address NSFileHandlingPanel deprecation by using NSModalResponse instead.
0.1.1 (2017-08-09) 0.1.1 (2017-08-09)
------------------------------------------------------------------------ ------------------------------------------------------------------------

View File

@ -102,7 +102,8 @@ namespace OpenRCT2 { namespace Ui
panel.title = [NSString stringWithUTF8String:desc.Title.c_str()]; panel.title = [NSString stringWithUTF8String:desc.Title.c_str()];
panel.allowedFileTypes = extensions; panel.allowedFileTypes = extensions;
panel.directoryURL = [NSURL fileURLWithPath:directory]; panel.directoryURL = [NSURL fileURLWithPath:directory];
if ([panel runModal] == NSFileHandlingPanelCancelButton){ if ([panel runModal] == NSModalResponseCancel)
{
return std::string(); return std::string();
} else { } else {
return panel.URL.path.UTF8String; return panel.URL.path.UTF8String;
@ -118,7 +119,7 @@ namespace OpenRCT2 { namespace Ui
panel.canChooseFiles = false; panel.canChooseFiles = false;
panel.canChooseDirectories = true; panel.canChooseDirectories = true;
panel.allowsMultipleSelection = false; panel.allowsMultipleSelection = false;
if ([panel runModal] == NSFileHandlingPanelOKButton) if ([panel runModal] == NSModalResponseOK)
{ {
NSString *selectedPath = panel.URL.path; NSString *selectedPath = panel.URL.path;
const char *path = selectedPath.UTF8String; const char *path = selectedPath.UTF8String;