This commit is contained in:
Thomas R 2022-01-13 10:50:08 +01:00
parent 8849d1b66c
commit 5efd728e9b
No known key found for this signature in database
GPG Key ID: E538821A6CDFDAD7

View File

@ -73,23 +73,24 @@ void ConfigBuilder::parseFile(const string& fname) {
internalValues[fullKey] = value;
}else{
listIndex = 0;
match = line.find(':');
if (match == string::npos)throw config_error("Line "+ to_string(lineno)+" invalid : |"+line+"|");
string key = line.substr(0, match);
string localKey = line.substr(0, match);
string value = line.substr(match + 1);
trimSpaces(key);
trimSpaces(localKey);
sanitizeValue(value);
if (value.empty()) {
keyParts.resize(currentIndent);
keyParts.push_back(key);
listIndex = 0;
keyParts.push_back(localKey);
} else {
string fullKey;
for (unsigned i = 0; i < currentIndent; ++i) {
fullKey.append(keyParts[i]);
fullKey.append(".");
}
fullKey.append(key);
fullKey.append(localKey);
internalValues[fullKey] = value;
}
}