Find Install directory of LibreOffice on Linux

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.

Hallo

http://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1util_1_1PathSubstitution.html

 pathsubstitution = createUnoService("com.sun.star.util.PathSubstitution")
 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
/usr/bin/soffice

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

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

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.