1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fixup Config

This commit is contained in:
Steffen Vogel 2021-02-19 06:49:46 +01:00
parent 256d53b27f
commit 85a6ecc6fa
2 changed files with 5 additions and 5 deletions

View file

@ -78,7 +78,7 @@ protected:
json_t * walkStrings(json_t *in, str_walk_fcn_t cb);
/** Get the include dirs */
std::list<std::filesystem::path> getIncludeDirs() const;
std::list<std::filesystem::path> getIncludeDirs(FILE *f) const;
public:
json_t *root;

View file

@ -142,7 +142,7 @@ json_t * Config::decode(FILE *f)
return root;
}
std::list<std::filesystem::path> Config::getIncludeDirs()
std::list<std::filesystem::path> Config::getIncludeDirs(FILE *f) const
{
auto uri = fs::read_symlink(fs::path("/proc/self/fd") / std::to_string(fileno(f)));
if (isLocalFile(uri)) {
@ -165,11 +165,11 @@ json_t * Config::libconfigDecode(FILE *f)
config_set_auto_convert(&cfg, 1);
/* Setup libconfig include path. */
auto inclDirs = getIncludeDirs();
auto inclDirs = getIncludeDirs(f);
if (inclDirs.size() > 0) {
logger->info("Setting include dir to: {}", inclDirs[0]);
logger->info("Setting include dir to: {}", inclDirs.front());
config_set_include_dir(&cfg, inclDirs[0].c_str());
config_set_include_dir(&cfg, inclDirs.front().c_str());
if (inclDirs.size() > 1) {
logger->warn("Ignoring all but the first include directories for libconfig");