use xdg-open in wxLaunchDefaultBrowser() on Unix if available

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51329 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-01-22 10:20:02 +00:00
parent 97f3b1e939
commit ae46a7fd15

View File

@@ -1081,6 +1081,20 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
#ifdef __UNIX__ #ifdef __UNIX__
// Our best best is to use xdg-open from freedesktop.org cross-desktop
// compatibility suite xdg-utils
// (see http://portland.freedesktop.org/wiki/) -- this is installed on
// most modern distributions and may be tweaked by them to handle
// distribution specifics. Only if that fails, try to find the right
// browser ourselves.
wxString path, xdg_open;
if ( wxGetEnv("PATH", &path) &&
wxFindFileInPath(&xdg_open, path, "xdg-open") )
{
if ( wxExecute(xdg_open + " " + url) )
return true;
}
wxString desktop = wxTheApp->GetTraits()->GetDesktopEnvironment(); wxString desktop = wxTheApp->GetTraits()->GetDesktopEnvironment();
// GNOME and KDE desktops have some applications which should be always installed // GNOME and KDE desktops have some applications which should be always installed