Kaydet (Commit) 28a03248 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 9fee132c
......@@ -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()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment