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; internalValues[fullKey] = value;
}else{ }else{
listIndex = 0;
match = line.find(':'); match = line.find(':');
if (match == string::npos)throw config_error("Line "+ to_string(lineno)+" invalid : |"+line+"|"); 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); string value = line.substr(match + 1);
trimSpaces(key); trimSpaces(localKey);
sanitizeValue(value); sanitizeValue(value);
if (value.empty()) { if (value.empty()) {
keyParts.resize(currentIndent); keyParts.resize(currentIndent);
keyParts.push_back(key); keyParts.push_back(localKey);
listIndex = 0;
} else { } else {
string fullKey; string fullKey;
for (unsigned i = 0; i < currentIndent; ++i) { for (unsigned i = 0; i < currentIndent; ++i) {
fullKey.append(keyParts[i]); fullKey.append(keyParts[i]);
fullKey.append("."); fullKey.append(".");
} }
fullKey.append(key); fullKey.append(localKey);
internalValues[fullKey] = value; internalValues[fullKey] = value;
} }
} }