substitution fix

This commit is contained in:
2024-07-09 21:47:18 +03:00
parent 0bafd3fa98
commit a16e0b7659

View File

@@ -194,6 +194,8 @@ PIValueTree PIValueTreeConversions::fromText(PIIODevice * device) {
comm.trim(); comm.trim();
line.cutRight(1).trim(); line.cutRight(1).trim();
} }
for (const auto & s: substitutions)
line.replaceAll("${" + s.first + "}", s.second);
ind = line.find('='); ind = line.find('=');
if (ind > 0) { if (ind > 0) {
path = prefix; path = prefix;
@@ -221,10 +223,7 @@ PIValueTree PIValueTreeConversions::fromText(PIIODevice * device) {
} }
PIValueTree & leaf(ret[path]); PIValueTree & leaf(ret[path]);
leaf.setComment(comm); leaf.setComment(comm);
line = unmask(line); leaf.setValue(unmask(line));
for (const auto & s: substitutions)
line.replaceAll("${" + s.first + "}", s.second);
leaf.setValue(line);
substitutions[path.join('.')] = leaf.value().toString(); substitutions[path.join('.')] = leaf.value().toString();
if (!path.contains(_attribute_)) if (!path.contains(_attribute_))
if (!leaf.contains({_attribute_, "type"})) leaf[_attribute_].addChild({"type", type}); if (!leaf.contains({_attribute_, "type"})) leaf[_attribute_].addChild({"type", type});