Configuration update application at startup

This commit is contained in:
Vojtech Kral 2018-04-12 20:04:48 +02:00
parent b030791384
commit b49b59cbb2
14 changed files with 288 additions and 54 deletions

View file

@ -141,7 +141,7 @@ size_t Index::load(const boost::filesystem::path &path)
return m_configs.size();
}
Index::const_iterator Index::find(const Semver &ver)
Index::const_iterator Index::find(const Semver &ver) const
{
Version key;
key.config_version = ver;
@ -163,12 +163,11 @@ Index::const_iterator Index::recommended() const
std::vector<Index> Index::load_db()
{
boost::filesystem::path data_dir = boost::filesystem::path(Slic3r::data_dir());
boost::filesystem::path vendor_dir = data_dir / "vendor";
boost::filesystem::path cache_dir = boost::filesystem::path(Slic3r::data_dir()) / "cache";
std::vector<Index> index_db;
std::string errors_cummulative;
for (auto &dir_entry : boost::filesystem::directory_iterator(vendor_dir))
for (auto &dir_entry : boost::filesystem::directory_iterator(cache_dir))
if (boost::filesystem::is_regular_file(dir_entry.status()) && boost::algorithm::iends_with(dir_entry.path().filename().string(), ".idx")) {
Index idx;
try {