Added code for next step of a preset's aliasing

This commit is contained in:
YuSanka 2019-11-25 10:40:36 +01:00
parent 1096c24fae
commit 6429c3bd89
2 changed files with 10 additions and 22 deletions

View file

@ -1133,12 +1133,10 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
preset_name = section.first.substr(9);
for (const auto& item : section.second)
{
if (boost::starts_with(item.first, "alias")) {
alias_name = item.second.data();
break;
}
}
} else if (boost::starts_with(section.first, "sla_print:")) {
presets = &this->sla_prints;
loaded = &loaded_sla_prints;
@ -1295,8 +1293,14 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
loaded.is_system = true;
loaded.vendor = vendor_profile;
}
if (!alias_name.empty())
loaded.alias = alias_name;
// next step of an preset name aliasing
int end_pos = preset_name.find_first_of("@");
if (end_pos != std::string::npos)
alias_name = preset_name.substr(0, end_pos - 1);
loaded.alias = alias_name.empty() ? preset_name : alias_name;
++ presets_loaded;
}
}