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

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51328 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-01-22 10:19:39 +00:00
parent 8bd0636fca
commit a9cb1b92a3
2 changed files with 15 additions and 0 deletions

View File

@@ -119,6 +119,7 @@ All (Unix):
- Fixed shared libraries to not depend on GStreamer when built with - Fixed shared libraries to not depend on GStreamer when built with
--enable-media; only wxMedia library depends on it now. --enable-media; only wxMedia library depends on it now.
- wxLaunchDefaultBrowser() now uses xdg-open if available.
wxMSW: wxMSW:

View File

@@ -864,6 +864,20 @@ static bool wxLaunchDefaultBrowserBaseImpl(const wxString& url, 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(_T("PATH"), &path) &&
wxFindFileInPath(&xdg_open, path, _T("xdg-open")) )
{
if ( wxExecute(xdg_open + _T(" ") + 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