From 42ab15c6d0c0c8c26621d7471d7514c755cf767b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Fri, 23 Dec 2016 17:30:05 +0800 Subject: [PATCH] Added a simple check for the --accept parameter instead of -accept for LibreOffice on POSIX systems. --- TODO | 4 +--- bin/obasync | 10 +++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 9e1187b..28ebb59 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,5 @@ obasync TODO -* LibreOffice switch (--xxx or -xxx) -* LibreOffice on MacOSX (how to install?) -* Linux system-bundled LibreOffice. +* How to install with LibreOffice on MacOSX * Writes the README (reStructureText). * Documentation. diff --git a/bin/obasync b/bin/obasync index 77e4ee8..988ee1b 100755 --- a/bin/obasync +++ b/bin/obasync @@ -358,10 +358,14 @@ class Office: "OpenOffice/LibreOffice installation.", file=sys.stderr) sys.exit(1) + param = "-accept=socket,host=localhost,port=%d;urp;" % \ + self.port + # LibreOffice on POSIX systems uses --accept instead of + # -accept now. + if ooexec.lower().find("libreoffice") != -1: + param = "-" + param try: - os.execl(ooexec, ooexec, - "-accept=socket,host=localhost,port=%d;urp;" % - self.port) + os.execl(ooexec, ooexec, param) except OSError: print("%s: Failed to run the" " OpenOffice/LibreOffice server." % ooexec,