Allow plots.xml to be read if model.xml doesn't contain plots

This commit is contained in:
Paul Romano 2023-04-08 14:58:00 +02:00
parent d1036561a9
commit 35ef5b06f8

View file

@ -358,7 +358,7 @@ bool read_model_xml()
for (const auto& input : other_inputs) {
if (file_exists(settings::path_input + input)) {
warning((fmt::format("Other XML file input(s) are present. These files "
"will be ignored in favor of the {} file.",
"may be ignored in favor of the {} file.",
model_filename)));
break;
}
@ -392,8 +392,16 @@ bool read_model_xml()
// Initialize distribcell_filters
prepare_distribcell();
if (check_for_node(root, "plots"))
if (check_for_node(root, "plots")) {
read_plots_xml(root.child("plots"));
} else {
// When no <plots> element is present in the model.xml file, check for a
// regular plots.xml file
std::string filename = settings::path_input + "plots.xml";
if (file_exists(filename)) {
read_plots_xml();
}
}
return true;
}