diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-07-05 18:43:25 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-07-06 09:53:01 +0000 |
commit | c3a90d4579518e93c0b920e5ad8d2692c2a8a116 (patch) | |
tree | 1da28133ff33b76c01311fdf9ec33bb61f97e3f6 /shell | |
parent | 3a9fb7a6bf34c7ad5647c4b84a91f43a41826dcd (diff) |
Workaround to call /app/bin/xdg-open when run under flatpak
LibreOffice wants to open URLs by calling /usr/bin/xdg-open, which the flatpak
org.gnome.Platform runtime does not provide. However,
<https://github.com/flatpak/xdg-desktop-portal> will provide a Desktop portal
through which an application can make an OpenURI request. So the idea is to
include a fake xdg-open application in the LO flatpak, that will use gdbus to
call that portal. However, I see no way to make the LO flatpak provide that as
/usr/bin/xdg-open, so instead provide it as /app/bin/xdg-open and hack LO to
use that path when run under flatpak (where the LIBO_FLATPAK environment
variable is already used for the OfficeIPCThread).
Change-Id: I63bc0bfb937ef767958ba4d34b0c3653e38ec868
(cherry picked from commit 28a03248b1d1649e157b788e43dfe8326f165379)
Reviewed-on: https://gerrit.libreoffice.org/26962
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/source/unix/exec/shellexec.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index cb9f2e53effe..7f12a80b76ef 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -37,6 +37,7 @@ #include "uno/current_context.hxx" +#include <cstdlib> #include <string.h> #include <errno.h> #include <unistd.h> @@ -153,8 +154,11 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar aBuffer.append("open --"); #else // Just use xdg-open on non-Mac - - aBuffer.append("/usr/bin/xdg-open"); + if (std::getenv("LIBO_FLATPAK") != nullptr) { + aBuffer.append("/app/bin/xdg-open"); + } else { + aBuffer.append("/usr/bin/xdg-open"); + } #endif aBuffer.append(" "); escapeForShell(aBuffer, OUStringToOString(aURL, osl_getThreadTextEncoding())); |