diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 128c09b38..df9d57fef 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -35,6 +35,7 @@ import logging import locale import os import re +from shutil import which from subprocess import Popen, PIPE import sys import urllib.request @@ -406,13 +407,18 @@ def get_uno_command(): """ Returns the UNO command to launch an openoffice.org instance. """ - COMMAND = 'soffice' + for command in ['libreoffice', 'soffice']: + if which(command): + break + else: + raise FileNotFoundError('Command not found') + OPTIONS = '--nologo --norestore --minimized --nodefault --nofirststartwizard' if UNO_CONNECTION_TYPE == 'pipe': CONNECTION = '"--accept=pipe,name=openlp_pipe;urp;"' else: CONNECTION = '"--accept=socket,host=localhost,port=2002;urp;"' - return '%s %s %s' % (COMMAND, OPTIONS, CONNECTION) + return '%s %s %s' % (command, OPTIONS, CONNECTION) def get_uno_instance(resolver):