Fix wxLaunchDefault{Application,Browser}() for arguments containing spaces
See #16581
This commit is contained in:
@@ -2660,7 +2660,11 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags)
|
|||||||
if ( wxGetEnv("PATH", &path) &&
|
if ( wxGetEnv("PATH", &path) &&
|
||||||
wxFindFileInPath(&xdg_open, path, "xdg-open") )
|
wxFindFileInPath(&xdg_open, path, "xdg-open") )
|
||||||
{
|
{
|
||||||
if ( wxExecute(xdg_open + " " + document) )
|
const char* argv[3];
|
||||||
|
argv[0] = xdg_open.fn_str();
|
||||||
|
argv[1] = document.fn_str();
|
||||||
|
argv[2] = NULL;
|
||||||
|
if (wxExecute(argv))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2687,6 +2691,10 @@ wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params)
|
|||||||
#endif // GTK_CHECK_VERSION(2,14,0)
|
#endif // GTK_CHECK_VERSION(2,14,0)
|
||||||
#endif // __WXGTK__
|
#endif // __WXGTK__
|
||||||
|
|
||||||
|
const char* argv[4];
|
||||||
|
argv[1] = params.GetPathOrURL().fn_str();
|
||||||
|
argv[2] = NULL;
|
||||||
|
|
||||||
// Our best best is to use xdg-open from freedesktop.org cross-desktop
|
// Our best best is to use xdg-open from freedesktop.org cross-desktop
|
||||||
// compatibility suite xdg-utils
|
// compatibility suite xdg-utils
|
||||||
// (see http://portland.freedesktop.org/wiki/) -- this is installed on
|
// (see http://portland.freedesktop.org/wiki/) -- this is installed on
|
||||||
@@ -2697,7 +2705,8 @@ wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params)
|
|||||||
if ( wxGetEnv("PATH", &path) &&
|
if ( wxGetEnv("PATH", &path) &&
|
||||||
wxFindFileInPath(&xdg_open, path, "xdg-open") )
|
wxFindFileInPath(&xdg_open, path, "xdg-open") )
|
||||||
{
|
{
|
||||||
if ( wxExecute(xdg_open + " " + params.GetPathOrURL()) )
|
argv[0] = xdg_open.fn_str();
|
||||||
|
if (wxExecute(argv))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2715,16 +2724,19 @@ wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params)
|
|||||||
output, errors, wxEXEC_NODISABLE );
|
output, errors, wxEXEC_NODISABLE );
|
||||||
if (res >= 0 && errors.GetCount() == 0)
|
if (res >= 0 && errors.GetCount() == 0)
|
||||||
{
|
{
|
||||||
wxString cmd = output[0];
|
argv[0] = output[0].fn_str();
|
||||||
cmd << wxT(' ') << params.GetPathOrURL();
|
if (wxExecute(argv))
|
||||||
if (wxExecute(cmd))
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (desktop == wxT("KDE"))
|
else if (desktop == wxT("KDE"))
|
||||||
{
|
{
|
||||||
// kfmclient directly opens the given URL
|
// kfmclient directly opens the given URL
|
||||||
if (wxExecute(wxT("kfmclient openURL ") + params.GetPathOrURL()))
|
argv[2] = argv[1];
|
||||||
|
argv[0] = "kfmclient";
|
||||||
|
argv[1] = "openURL";
|
||||||
|
argv[3] = NULL;
|
||||||
|
if (wxExecute(argv))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user