mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-02 19:44:00 -06:00
PresetUpdater: Fix: Compare versions when installing indices
This commit is contained in:
parent
37cf839b27
commit
b506aa11fa
1 changed files with 8 additions and 3 deletions
|
@ -220,9 +220,16 @@ void PresetUpdater::priv::check_install_indices() const
|
||||||
if (path.extension() == ".idx") {
|
if (path.extension() == ".idx") {
|
||||||
const auto path_in_cache = cache_path / path.filename();
|
const auto path_in_cache = cache_path / path.filename();
|
||||||
|
|
||||||
// TODO: compare versions
|
|
||||||
if (! fs::exists(path_in_cache)) {
|
if (! fs::exists(path_in_cache)) {
|
||||||
fs::copy_file(path, path_in_cache, fs::copy_option::overwrite_if_exists);
|
fs::copy_file(path, path_in_cache, fs::copy_option::overwrite_if_exists);
|
||||||
|
} else {
|
||||||
|
Index idx_rsrc, idx_cache;
|
||||||
|
idx_rsrc.load(path);
|
||||||
|
idx_cache.load(path_in_cache);
|
||||||
|
|
||||||
|
if (idx_cache.version() < idx_rsrc.version()) {
|
||||||
|
fs::copy_file(path, path_in_cache, fs::copy_option::overwrite_if_exists);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,8 +274,6 @@ Updates PresetUpdater::priv::config_update() const
|
||||||
const auto cached_vp = VendorProfile::from_ini(path_in_cache, false);
|
const auto cached_vp = VendorProfile::from_ini(path_in_cache, false);
|
||||||
if (cached_vp.config_version == recommended->config_version) {
|
if (cached_vp.config_version == recommended->config_version) {
|
||||||
updates.emplace_back(std::move(path_in_cache), bundle_path, *recommended);
|
updates.emplace_back(std::move(path_in_cache), bundle_path, *recommended);
|
||||||
} else {
|
|
||||||
// XXX: ?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue