Fixed upgrade of vendor profile from the application resources
after an upgrade of the application.
This commit is contained in:
parent
e19a74865b
commit
88bf7c852c
@ -169,7 +169,8 @@ sub OnInit {
|
|||||||
$self->update_ui_from_settings;
|
$self->update_ui_from_settings;
|
||||||
});
|
});
|
||||||
|
|
||||||
# The following event is emited by PresetUpdater (C++)
|
# The following event is emited by PresetUpdater (C++) to inform about
|
||||||
|
# the newer Slic3r application version avaiable online.
|
||||||
EVT_COMMAND($self, -1, $VERSION_ONLINE_EVENT, sub {
|
EVT_COMMAND($self, -1, $VERSION_ONLINE_EVENT, sub {
|
||||||
my ($self, $event) = @_;
|
my ($self, $event) = @_;
|
||||||
my $version = $event->GetString;
|
my $version = $event->GetString;
|
||||||
|
@ -326,6 +326,8 @@ Updates PresetUpdater::priv::get_config_updates() const
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Getting a recommended version from the latest index, wich may have been downloaded
|
||||||
|
// from the internet, or installed / updated from the installation resources.
|
||||||
const auto recommended = idx.recommended();
|
const auto recommended = idx.recommended();
|
||||||
if (recommended == idx.end()) {
|
if (recommended == idx.end()) {
|
||||||
BOOST_LOG_TRIVIAL(error) << boost::format("No recommended version for vendor: %1%, invalid index?") % idx.vendor();
|
BOOST_LOG_TRIVIAL(error) << boost::format("No recommended version for vendor: %1%, invalid index?") % idx.vendor();
|
||||||
@ -353,25 +355,34 @@ Updates PresetUpdater::priv::get_config_updates() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto path_src = cache_path / (idx.vendor() + ".ini");
|
auto path_src = cache_path / (idx.vendor() + ".ini");
|
||||||
|
auto path_in_rsrc = rsrc_path / (idx.vendor() + ".ini");
|
||||||
if (! fs::exists(path_src)) {
|
if (! fs::exists(path_src)) {
|
||||||
auto path_in_rsrc = rsrc_path / (idx.vendor() + ".ini");
|
|
||||||
if (! fs::exists(path_in_rsrc)) {
|
if (! fs::exists(path_in_rsrc)) {
|
||||||
BOOST_LOG_TRIVIAL(warning) << boost::format("Index for vendor %1% indicates update, but bundle found in neither cache nor resources")
|
BOOST_LOG_TRIVIAL(warning) << boost::format("Index for vendor %1% indicates update, but bundle found in neither cache nor resources")
|
||||||
% idx.vendor();;
|
% idx.vendor();
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
path_src = std::move(path_in_rsrc);
|
path_src = std::move(path_in_rsrc);
|
||||||
|
path_in_rsrc.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto new_vp = VendorProfile::from_ini(path_src, false);
|
auto new_vp = VendorProfile::from_ini(path_src, false);
|
||||||
|
bool found = false;
|
||||||
if (new_vp.config_version == recommended->config_version) {
|
if (new_vp.config_version == recommended->config_version) {
|
||||||
updates.updates.emplace_back(std::move(path_src), std::move(bundle_path), *recommended);
|
updates.updates.emplace_back(std::move(path_src), std::move(bundle_path), *recommended);
|
||||||
} else {
|
found = true;
|
||||||
|
} else if (! path_in_rsrc.empty() && fs::exists(path_in_rsrc)) {
|
||||||
|
new_vp = VendorProfile::from_ini(path_in_rsrc, false);
|
||||||
|
if (new_vp.config_version == recommended->config_version) {
|
||||||
|
updates.updates.emplace_back(std::move(path_in_rsrc), std::move(bundle_path), *recommended);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (! found)
|
||||||
BOOST_LOG_TRIVIAL(warning) << boost::format("Index for vendor %1% indicates update (%2%) but the new bundle was found neither in cache nor resources")
|
BOOST_LOG_TRIVIAL(warning) << boost::format("Index for vendor %1% indicates update (%2%) but the new bundle was found neither in cache nor resources")
|
||||||
% idx.vendor()
|
% idx.vendor()
|
||||||
% recommended->config_version.to_string();
|
% recommended->config_version.to_string();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user