Re: how to read config file from current dir (relative to a binary using the lib)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Helmut Tessarek wrote:
[...]

Anyway, I understand that using the ENV var is the only way to manipulate the
config path. But here's the next problem.

a) fontconfig linked statically
b) some binary using fontconfig also linked statically

I use setenv in b) to set the FONTCONFIG_PATH variable, but a) ignores it.

Should work:

/* ...
 * no FcInit*() before this point */
char cfgpath[PATH_MAX];
/* need to add "." if relative paths are involved: */
snprintf(cfgpath,PATH_MAX,"%s/cfg:.",dirname(argv[0]));
setenv("FONTCONFIG_PATH",cfgpath,1);
FcInit();

Then, if ./cfg is a valid configuration:

FC_DEBUG=1024 ./the-binary

shows:

        Loading config file ./cfg/fonts.conf
        Scanning config dir ./cfg/conf.d
        Loading config file ././cfg/conf.d/20-fix-globaladvance.conf
        [...]

Note that binaries on Windows have different defaults than UNIX.

Raimund

--
Worringer Str 31, Duesseldorf 40211 Germany   home: <rs@xxxxxxxx>
+49-179-2981632 icq 16845346                  work: <rs@xxxxxxxxxxxxxxx>
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig


[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux