From ae46a7fd15bff134460b9af46af896136b018fad Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 22 Jan 2008 10:20:02 +0000 Subject: [PATCH] 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 --- src/common/utilscmn.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 2beddfe3a6..df728c2228 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -1081,6 +1081,20 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags) #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(); // GNOME and KDE desktops have some applications which should be always installed -- 2.50.0