find at runtime where LibreOffice is being executed from

Lionel Elie Mamane lionel at mamane.lu
Sat Jun 18 15:44:35 UTC 2016


Hi,

Does anybody have an idea how we can determine at runtime where the
LibreOffice installation root is?

The difficulty we are having with firebird is that is needs to find a
"security3.fdb" file. So we put it in instdir/share/ and we want
firebird to look there.

But now, when running from the instdir in the source dir, that will be
something like

 /home/username/sources/libreoffice/.../instdir/share

but after a "real" installation the exact same binary will be in
something like

 /opt/libreoffice5.3/share
 /usr/lib/libreoffice
 /usr/local/lib/libreoffice

So we need to determine at _runtime_ where LibreOffice is being run
from... I see that the "soffice" script has a "sd_prog" variable; if
we just export it, we could use that, something like the
concatenation of getenv("sd_prog") and "../share/".

Is it OK if we do that? Will it work on other platforms than Unixy
systems? Is there already another mechanism to achieve the same result
in LibreOffice that I don't know about?

Thanks in advance,

Lionel


More information about the LibreOffice mailing list