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

config: fix unit tests

This commit is contained in:
Steffen Vogel 2021-09-19 18:15:05 +02:00
parent 07fbbf11a8
commit 30830ebca3

View file

@ -171,17 +171,24 @@ std::list<std::string> Config::resolveIncludes(const std::string &n)
auto name = n;
resolveEnvVars(name);
for (auto &dir : includeDirectories) {
auto pattern = fmt::format("{}/{}", dir, name.c_str());
ret = glob(pattern.c_str(), flags, nullptr, &gb);
if (ret && ret != GLOB_NOMATCH) {
if (name.size() >= 1 && name[0] == '/') { // absolute path
ret = glob(name.c_str(), flags, nullptr, &gb);
if (ret && ret != GLOB_NOMATCH)
gb.gl_pathc = 0;
}
else { // relative path
for (auto &dir : includeDirectories) {
auto pattern = fmt::format("{}/{}", dir, name.c_str());
goto out;
ret = glob(pattern.c_str(), flags, nullptr, &gb);
if (ret && ret != GLOB_NOMATCH) {
gb.gl_pathc = 0;
goto out;
}
flags |= GLOB_APPEND;
}
flags |= GLOB_APPEND;
}
out: std::list<std::string> files;