Fixing AppConfig::reset(), calling reset() before load().

This fixes some issues when importing newer configuration over the current.
This commit is contained in:
Vojtech Bubnik 2021-12-15 12:04:43 +01:00
parent 12756e7979
commit 41fa4a05f9
2 changed files with 7 additions and 4 deletions

View File

@ -43,6 +43,10 @@ const std::string AppConfig::SECTION_MATERIALS = "sla_materials";
void AppConfig::reset()
{
m_storage.clear();
m_vendors.clear();
m_dirty = false;
m_orig_version = Semver::invalid();
m_legacy_datadir = false;
set_defaults();
};
@ -245,6 +249,8 @@ static bool verify_config_file_checksum(boost::nowide::ifstream &ifs)
std::string AppConfig::load(const std::string &path)
{
this->reset();
// 1) Read the complete config file into a boost::property_tree.
namespace pt = boost::property_tree;
pt::ptree tree;

View File

@ -22,10 +22,7 @@ public:
};
explicit AppConfig(EAppMode mode) :
m_dirty(false),
m_orig_version(Semver::invalid()),
m_mode(mode),
m_legacy_datadir(false)
m_mode(mode)
{
this->reset();
}