mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 23:04:36 +01:00
Fix Zenity/Kdialog not opening in paths with single quotes
This commit is contained in:
@@ -133,6 +133,7 @@ namespace OpenRCT2::Ui
|
||||
{
|
||||
std::string result;
|
||||
std::string executablePath;
|
||||
u8string directory = EscapePathForShell(desc.InitialDirectory + '/');
|
||||
DIALOG_TYPE dtype = GetDialogApp(&executablePath);
|
||||
switch (dtype)
|
||||
{
|
||||
@@ -141,8 +142,8 @@ namespace OpenRCT2::Ui
|
||||
std::string action = (desc.Type == FileDialogType::Open) ? "--getopenfilename" : "--getsavefilename";
|
||||
std::string filter = GetKDialogFilterString(desc.Filters);
|
||||
std::string cmd = String::StdFormat(
|
||||
"%s --title '%s' %s '%s' '%s'", executablePath.c_str(), desc.Title.c_str(), action.c_str(),
|
||||
desc.InitialDirectory.c_str(), filter.c_str());
|
||||
"%s --title '%s' %s %s '%s'", executablePath.c_str(), desc.Title.c_str(), action.c_str(),
|
||||
directory.c_str(), filter.c_str());
|
||||
std::string output;
|
||||
if (Platform::Execute(cmd, &output) == 0)
|
||||
{
|
||||
@@ -160,8 +161,8 @@ namespace OpenRCT2::Ui
|
||||
}
|
||||
std::string filters = GetZenityFilterString(desc.Filters);
|
||||
std::string cmd = String::StdFormat(
|
||||
"%s %s --filename='%s/' %s --title='%s' / %s", executablePath.c_str(), action.c_str(),
|
||||
desc.InitialDirectory.c_str(), flags.c_str(), desc.Title.c_str(), filters.c_str());
|
||||
"%s %s --filename=%s %s --title='%s' / %s", executablePath.c_str(), action.c_str(), directory.c_str(),
|
||||
flags.c_str(), desc.Title.c_str(), filters.c_str());
|
||||
std::string output;
|
||||
if (Platform::Execute(cmd, &output) == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user