Ask Your Question

Find Install directory of LibreOffice on Linux [closed]

asked 2016-08-29 06:22:50 +0200

mark_t gravatar image

updated 2020-07-21 06:03:01 +0200

Alex Kemp gravatar image

Is there any way to find the path of the install directory of LibreOffice where the soffice.bin is located?

It might be possible to use GetCommandLineW on windows, but this is dependent on a windows dll.

Private Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineW" () As Long

Is there some equivalent for linux?

Trying to find the path to the running executable to allow timed calls to macros via Shell command, without hardcoding the path in the macro as this is sometimes different on different installations.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-07-21 06:03:37.581729

1 Answer

Sort by » oldest newest most voted

answered 2016-08-29 07:21:09 +0200

karolus gravatar image

updated 2016-08-29 07:26:08 +0200


 pathsubstitution = createUnoService("")
 installpath = pathsubstitution.substituteVariables('$(inst)',1)

 →→ 'file:///usr/lib/libreoffice/program/..'

but for LO distributed by the main-Linux-Distros this gives not the path to parentdirectory of executable soffice, in that case you should run from Commandline:

>> which soffice

if so, you need not to find the path to soffice first, simply use soffice in your Shell-Command

edit flag offensive delete link more


Thanks, I'll try both and post back here.

mark_t gravatar imagemark_t ( 2016-08-29 14:47:40 +0200 )edit

The first method you suggested works the way I was looking for thanks. I'm using $(prog). This allows my macro to find the executable for whichever version of office is running the macro, including if openoffice and libreoffice are both installed.

mark_t gravatar imagemark_t ( 2016-08-29 17:29:17 +0200 )edit

Question Tools

1 follower


Asked: 2016-08-29 06:22:50 +0200

Seen: 21,996 times

Last updated: Aug 29 '16