Adjust last change to conftree: treat non-existing topmost file as an empty one to support lean config dirs
This commit is contained in:
parent
b43d1b3287
commit
021941bf6f
@ -1 +1 @@
|
|||||||
1.26.1
|
1.26.2pre1
|
||||||
|
|||||||
@ -62,6 +62,7 @@
|
|||||||
#include <istream>
|
#include <istream>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#endif
|
#endif
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "pathut.h"
|
#include "pathut.h"
|
||||||
|
|
||||||
@ -571,17 +572,23 @@ private:
|
|||||||
/// if some files were not readable/parsable. Now fail if any
|
/// if some files were not readable/parsable. Now fail if any
|
||||||
/// fails.
|
/// fails.
|
||||||
void construct(const std::vector<std::string>& fns, bool ro) {
|
void construct(const std::vector<std::string>& fns, bool ro) {
|
||||||
bool ok = true;
|
bool ok{true};
|
||||||
|
bool first{true};
|
||||||
for (const auto& fn : fns) {
|
for (const auto& fn : fns) {
|
||||||
T* p = new T(fn.c_str(), ro);
|
T* p = new T(fn.c_str(), ro);
|
||||||
if (p && p->ok()) {
|
if (p && p->ok()) {
|
||||||
m_confs.push_back(p);
|
m_confs.push_back(p);
|
||||||
} else {
|
} else {
|
||||||
delete p;
|
delete p;
|
||||||
ok = false;
|
// In ro mode, we accept a non-existing topmost file
|
||||||
|
// and treat it as an empty one.
|
||||||
|
if (!(ro && first && !path_exists(fn))) {
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Only the first file is opened rw
|
// Only the first file is opened rw
|
||||||
ro = true;
|
ro = true;
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
m_ok = ok;
|
m_ok = ok;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user