diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index eac8d2b346..4f2684257b 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -1733,22 +1733,6 @@ void ContextQuit() GetContext()->Quit(); } -bool ContextOpenCommonFileDialog(utf8* outFilename, OpenRCT2::Ui::FileDialogDesc& desc, size_t outSize) -{ - try - { - std::string result = GetContext()->GetUiContext()->ShowFileDialog(desc); - String::Set(outFilename, outSize, result.c_str()); - return !result.empty(); - } - catch (const std::exception& ex) - { - LOG_ERROR(ex.what()); - outFilename[0] = '\0'; - return false; - } -} - u8string ContextOpenCommonFileDialog(OpenRCT2::Ui::FileDialogDesc& desc) { try diff --git a/src/openrct2/Context.h b/src/openrct2/Context.h index 2087fee0f4..31e4110bd8 100644 --- a/src/openrct2/Context.h +++ b/src/openrct2/Context.h @@ -232,5 +232,4 @@ void ContextHandleInput(); void ContextInputHandleKeyboard(bool isTitle); void ContextQuit(); bool ContextLoadParkFromStream(void* stream); -bool ContextOpenCommonFileDialog(utf8* outFilename, OpenRCT2::Ui::FileDialogDesc& desc, size_t outSize); u8string ContextOpenCommonFileDialog(OpenRCT2::Ui::FileDialogDesc& desc); diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index c29f8a78be..bf35f11209 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -749,7 +749,7 @@ namespace OpenRCT2::Config return {}; } - static bool SelectGogInstaller(utf8* installerPath) + static u8string SelectGogInstaller() { FileDialogDesc desc{}; desc.Type = FileDialogType::Open; @@ -760,7 +760,7 @@ namespace OpenRCT2::Config const auto userHomePath = Platform::GetFolderPath(SPECIAL_FOLDER::USER_HOME); desc.InitialDirectory = userHomePath; - return ContextOpenCommonFileDialog(installerPath, desc, 4096); + return ContextOpenCommonFileDialog(desc); } static bool ExtractGogInstaller(const u8string& installerPath, const u8string& targetPath) @@ -888,8 +888,8 @@ namespace OpenRCT2::Config while (true) { uiContext->ShowMessageBox(LanguageGetString(STR_PLEASE_SELECT_GOG_INSTALLER)); - utf8 gogPath[4096]; - if (!SelectGogInstaller(gogPath)) + auto gogPath = SelectGogInstaller(); + if (gogPath.empty()) { // The user clicked "Cancel", so stop trying. return false;