Added mostly empty wxLaunchDefaultApplication
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -578,6 +578,9 @@ enum
|
||||
// Launch url in the user's default internet browser
|
||||
WXDLLIMPEXP_CORE bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0);
|
||||
|
||||
// Launch document in the user's default application
|
||||
WXDLLIMPEXP_CORE bool wxLaunchDefaultApplication(const wxString& path, int flags = 0);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Menu accelerators related things
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -933,6 +933,32 @@ void wxQsort(void *const pbase, size_t total_elems,
|
||||
|
||||
#if wxUSE_GUI
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Launch document with default app
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxLaunchDefaultApplication(const wxString &document, int flags)
|
||||
{
|
||||
wxUnusedVar(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.
|
||||
wxString path, xdg_open;
|
||||
if ( wxGetEnv("PATH", &path) &&
|
||||
wxFindFileInPath(&xdg_open, path, "xdg-open") )
|
||||
{
|
||||
if ( wxExecute(xdg_open + " " + document) )
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Launch default browser
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user