download missing resources

This commit is contained in:
David Kocik 2022-01-19 17:10:37 +01:00
parent 01d5b424c3
commit d9c7c675c4
3 changed files with 84 additions and 5 deletions

View file

@ -2099,6 +2099,29 @@ namespace PresetUtils {
}
return out;
}
bool vendor_profile_has_all_resources(const VendorProfile& vp, bool in_cache)
{
std::string vendor_folder = Slic3r::data_dir() + "/vendor/" + vp.id + "/";
std::string rsrc_folder = Slic3r::resources_dir() + "/profiles/" + vp.id + "/";
std::string cache_folder = Slic3r::data_dir() + "/cache/" + vp.id + "/";
for (const VendorProfile::PrinterModel& model : vp.models)
{
if ( !boost::filesystem::exists(boost::filesystem::path(vendor_folder + model.bed_texture))
&& !boost::filesystem::exists(boost::filesystem::path(rsrc_folder + model.bed_texture))
&& (!in_cache || !boost::filesystem::exists(boost::filesystem::path(cache_folder + model.bed_texture))))
return false;
if ( !boost::filesystem::exists(boost::filesystem::path(vendor_folder + model.bed_model))
&& !boost::filesystem::exists(boost::filesystem::path(rsrc_folder + model.bed_model))
&& (!in_cache || !boost::filesystem::exists(boost::filesystem::path(cache_folder + model.bed_model))))
return false;
if ( !boost::filesystem::exists(boost::filesystem::path(vendor_folder + model.id + "_thumbnail.png"))
&& !boost::filesystem::exists(boost::filesystem::path(rsrc_folder + model.id + "_thumbnail.png"))
&& (!in_cache || !boost::filesystem::exists(boost::filesystem::path(cache_folder + model.id + "_thumbnail.png"))))
return false;
}
return true;
}
} // namespace PresetUtils
} // namespace Slic3r