Access local resources > getenv("LD_ LIBRARY_PATH")


I wanted to share a trick I didn’t see on AppImages website, when preparing an appImage for using the Manual approach:
I was looking for where to store local resources not compiled in -in my case font files- and found a trick that seemed to work from main.c:
char * libpaths = getenv(“LD_LIBRARY_PATH”);
And that returned a long string containing:

So I took the first of those, stripped the /lib/: and added my resource folder path /fonts and used that in my program as an absolute path to the fonts, put my fonts there in .AppDir and it worked. Q. how reliable is that?


Please use paths relative to the main executable. Using LD_LIBRARY_PATH to find out where your main executable is is not reliable.

Please see