find at runtime where LibreOffice is being executed from

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Jun 18 15:51:51 UTC 2016


Hey Lionel,


On Sat, Jun 18, 2016 at 5:44 PM, Lionel Elie Mamane <lionel at mamane.lu>
wrote:

> 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?
>
>

There is already a way to do exactly thatand it is actually already used in
the old firebird code.

Have a look at connectivity/source/drivers/firebird/Driver.cxx:90

In general rtl::Bootstrap::expandMacros provides access to most of the
directories that are of interest to LibreOffice.

Regards,
Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20160618/3f3f54d5/attachment.html>


More information about the LibreOffice mailing list