Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::PresetUpdater::priv Struct Reference
+ Collaboration diagram for Slic3r::PresetUpdater::priv:

Public Member Functions

 priv ()
 
void set_download_prefs (const AppConfig *app_config)
 
bool get_file (const std::string &url, const fs::path &target_path) const
 
void prune_tmps () const
 
void sync_config (const VendorMap vendors, const std::string &index_archive_url)
 
void check_install_indices () const
 
Updates get_config_updates (const Semver &old_slic3r_version) const
 
bool perform_updates (Updates &&updates, bool snapshot=true) const
 
void set_waiting_updates (Updates u)
 
void get_missing_resource (const std::string &vendor, const std::string &filename, const std::string &url) const
 
void get_or_copy_missing_resource (const std::string &vendor, const std::string &filename, const std::string &url) const
 
void update_index_db ()
 

Public Attributes

std::vector< Indexindex_db
 
bool enabled_version_check
 
bool enabled_config_update
 
std::string version_check_url
 
fs::path cache_path
 
fs::path cache_vendor_path
 
fs::path rsrc_path
 
fs::path vendor_path
 
bool cancel
 
std::thread thread
 
bool has_waiting_updates { false }
 
Updates waiting_updates
 

Detailed Description

Constructor & Destructor Documentation

◆ priv()

Slic3r::PresetUpdater::priv::priv ( )
193 : cache_path(fs::path(Slic3r::data_dir()) / "cache")
194 , cache_vendor_path(cache_path / "vendor")
195 , rsrc_path(fs::path(resources_dir()) / "profiles")
196 , vendor_path(fs::path(Slic3r::data_dir()) / "vendor")
197 , cancel(false)
198{
199 set_download_prefs(GUI::wxGetApp().app_config);
200 // Install indicies from resources. Only installs those that are either missing or older than in resources.
202 // Load indices from the cache directory.
203 index_db = Index::load_db();
204}
const std::string & data_dir()
Definition utils.cpp:206
const std::string & resources_dir()
Definition utils.cpp:167
fs::path rsrc_path
Definition PresetUpdater.cpp:165
fs::path cache_vendor_path
Definition PresetUpdater.cpp:164
fs::path cache_path
Definition PresetUpdater.cpp:163
void set_download_prefs(const AppConfig *app_config)
Definition PresetUpdater.cpp:212
std::vector< Index > index_db
Definition PresetUpdater.cpp:157
void check_install_indices() const
Definition PresetUpdater.cpp:773
fs::path vendor_path
Definition PresetUpdater.cpp:166
bool cancel
Definition PresetUpdater.cpp:168

References check_install_indices(), index_db, and set_download_prefs().

+ Here is the call graph for this function:

Member Function Documentation

◆ check_install_indices()

void Slic3r::PresetUpdater::priv::check_install_indices ( ) const
774{
775 BOOST_LOG_TRIVIAL(info) << "Checking if indices need to be installed from resources...";
776
777 for (auto &dir_entry : boost::filesystem::directory_iterator(rsrc_path))
778 if (is_idx_file(dir_entry)) {
779 const auto &path = dir_entry.path();
780 const auto path_in_cache = cache_path / path.filename();
781
782 if (! fs::exists(path_in_cache)) {
783 BOOST_LOG_TRIVIAL(info) << "Install index from resources: " << path.filename();
784 copy_file_fix(path, path_in_cache);
785 } else {
786 Index idx_rsrc, idx_cache;
787 idx_rsrc.load(path);
788 idx_cache.load(path_in_cache);
789
790 if (idx_cache.version() < idx_rsrc.version()) {
791 BOOST_LOG_TRIVIAL(info) << "Update index from resources: " << path.filename();
792 copy_file_fix(path, path_in_cache);
793 }
794 }
795 }
796}
Definition Version.hpp:55
size_t load(const boost::filesystem::path &path)
Definition Version.cpp:120
Semver version() const
Definition Version.cpp:201
if(!(yy_init))
Definition lexer.c:1190
void copy_file_fix(const fs::path &source, const fs::path &target)
Definition PresetUpdater.cpp:56
bool is_idx_file(const boost::filesystem::directory_entry &dir_entry)
Definition utils.cpp:778
Definition args.hpp:18

References Slic3r::is_idx_file(), Slic3r::GUI::Config::Index::load(), and Slic3r::GUI::Config::Index::version().

Referenced by priv().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_config_updates()

Updates Slic3r::PresetUpdater::priv::get_config_updates ( const Semver old_slic3r_version) const
802{
803 Updates updates;
804
805 BOOST_LOG_TRIVIAL(info) << "Checking for cached configuration updates...";
806
807 // Over all indices from the cache directory:
808 for (const Index& idx : index_db) {
809 auto bundle_path = vendor_path / (idx.vendor() + ".ini");
810 auto bundle_path_idx = vendor_path / idx.path().filename();
811
812 if (! fs::exists(bundle_path)) {
813 BOOST_LOG_TRIVIAL(info) << format("Confing bundle not installed for vendor %1%, skipping: ", idx.vendor());
814 continue;
815 }
816
817 // Perform a basic load and check the version of the installed preset bundle.
818 VendorProfile vp;
819 try {
820 vp = VendorProfile::from_ini(bundle_path, false);
821 }
822 catch (const std::exception& e) {
823 BOOST_LOG_TRIVIAL(error) << format("Corrupted profile file for vendor %1% at %2%, message: %3%", idx.vendor(), bundle_path, e.what());
824 continue;
825 }
826 // Getting a recommended version from the latest index, wich may have been downloaded
827 // from the internet, or installed / updated from the installation resources.
828 auto recommended = idx.recommended();
829 if (recommended == idx.end()) {
830 BOOST_LOG_TRIVIAL(error) << format("No recommended version for vendor: %1%, invalid index? Giving up.", idx.vendor());
831 // XXX: what should be done here?
832 continue;
833 }
834
835 const auto ver_current = idx.find(vp.config_version);
836 const bool ver_current_found = ver_current != idx.end();
837
838 BOOST_LOG_TRIVIAL(debug) << format("Vendor: %1%, version installed: %2%%3%, version cached: %4%",
839 vp.name,
840 vp.config_version.to_string(),
841 (ver_current_found ? "" : " (not found in index!)"),
842 recommended->config_version.to_string());
843
844 if (! ver_current_found) {
845 // Any published config shall be always found in the latest config index.
846 auto message = format("Preset bundle `%1%` version not found in index: %2%", idx.vendor(), vp.config_version.to_string());
847 BOOST_LOG_TRIVIAL(error) << message;
848 GUI::show_error(nullptr, message);
849 continue;
850 }
851
852 bool current_not_supported = false; //if slcr is incompatible but situation is not downgrade, we do forced updated and this bool is information to do it
853
854 if (ver_current_found && !ver_current->is_current_slic3r_supported()){
855 if (ver_current->is_current_slic3r_downgrade()) {
856 // "Reconfigure" situation.
857 BOOST_LOG_TRIVIAL(warning) << "Current Slic3r incompatible with installed bundle: " << bundle_path.string();
858 updates.incompats.emplace_back(std::move(bundle_path), *ver_current, vp.name);
859 continue;
860 }
861 current_not_supported = true;
862 }
863
864 if (recommended->config_version < vp.config_version) {
865 BOOST_LOG_TRIVIAL(warning) << format("Recommended config version for the currently running PrusaSlicer is older than the currently installed config for vendor %1%. This should not happen.", idx.vendor());
866 continue;
867 }
868
869 if (recommended->config_version == vp.config_version) {
870 // The recommended config bundle is already installed.
871 continue;
872 }
873
874 // Config bundle update situation. The recommended config bundle version for this PrusaSlicer version from the index from the cache is newer
875 // than the version of the currently installed config bundle.
876
877 // The config index inside the cache directory (given by idx.path()) is one of the following:
878 // 1) The last config index downloaded by any previously running PrusaSlicer instance
879 // 2) The last config index installed by any previously running PrusaSlicer instance (older or newer) from its resources.
880 // 3) The last config index installed by the currently running PrusaSlicer instance from its resources.
881 // The config index is always the newest one (given by its newest config bundle referenced), and older config indices shall fully contain
882 // the content of the older config indices.
883
884 // Config bundle inside the cache directory.
885 fs::path path_in_cache = cache_path / (idx.vendor() + ".ini");
886 // Config bundle inside the resources directory.
887 fs::path path_in_rsrc = rsrc_path / (idx.vendor() + ".ini");
888 // Config index inside the resources directory.
889 fs::path path_idx_in_rsrc = rsrc_path / (idx.vendor() + ".idx");
890
891 // Search for a valid config bundle in the cache directory.
892 bool found = false;
893 Update new_update;
894 fs::path bundle_path_idx_to_install;
895 if (fs::exists(path_in_cache)) {
896 try {
897 VendorProfile new_vp = VendorProfile::from_ini(path_in_cache, true);
898 if (new_vp.config_version == recommended->config_version) {
899 // The config bundle from the cache directory matches the recommended version of the index from the cache directory.
900 // This is the newest known recommended config. Use it.
902 BOOST_LOG_TRIVIAL(warning) << "Some resources are missing for update of vedor " << new_vp.id;
903 }
904 new_update = Update(std::move(path_in_cache), std::move(bundle_path), *recommended, vp.name, vp.changelog_url, current_not_supported);
905 // and install the config index from the cache into vendor's directory.
906 bundle_path_idx_to_install = idx.path();
907 found = true;
908 }
909 } catch (const std::exception &ex) {
910 BOOST_LOG_TRIVIAL(info) << format("Failed to load the config bundle `%1%`: %2%", path_in_cache.string(), ex.what());
911 }
912 }
913
914 // Keep the rsrc_idx outside of the next block, as we will reference the "recommended" version by an iterator.
915 Index rsrc_idx;
916 if (! found && fs::exists(path_in_rsrc) && fs::exists(path_idx_in_rsrc)) {
917 // Trying the config bundle from resources (from the installation).
918 // In that case, the recommended version number has to be compared against the recommended version reported by the config index from resources as well,
919 // as the config index in the cache directory may already be newer, recommending a newer config bundle than available in cache or resources.
920 VendorProfile rsrc_vp;
921 try {
922 rsrc_vp = VendorProfile::from_ini(path_in_rsrc, false);
923 } catch (const std::exception &ex) {
924 BOOST_LOG_TRIVIAL(info) << format("Cannot load the config bundle at `%1%`: %2%", path_in_rsrc.string(), ex.what());
925 }
926 if (rsrc_vp.valid()) {
927 try {
928 rsrc_idx.load(path_idx_in_rsrc);
929 } catch (const std::exception &ex) {
930 BOOST_LOG_TRIVIAL(info) << format("Cannot load the config index at `%1%`: %2%", path_idx_in_rsrc.string(), ex.what());
931 }
932 recommended = rsrc_idx.recommended();
933 if (recommended != rsrc_idx.end() && recommended->config_version == rsrc_vp.config_version && recommended->config_version > vp.config_version) {
934 new_update = Update(std::move(path_in_rsrc), std::move(bundle_path), *recommended, vp.name, vp.changelog_url, current_not_supported);
935 bundle_path_idx_to_install = path_idx_in_rsrc;
936 found = true;
937 } else {
938 BOOST_LOG_TRIVIAL(warning) << format("The recommended config version for vendor `%1%` in resources does not match the recommended\n"
939 " config version for this version of PrusaSlicer. Corrupted installation?", idx.vendor());
940 }
941 }
942 }
943
944 if (found) {
945 // Load 'installed' idx, if any.
946 // 'Installed' indices are kept alongside the bundle in the `vendor` subdir
947 // for bookkeeping to remember a cancelled update and not offer it again.
948 if (fs::exists(bundle_path_idx)) {
949 Index existing_idx;
950 try {
951 existing_idx.load(bundle_path_idx);
952 // Find a recommended config bundle version for the slic3r version last executed. This makes sure that a config bundle update will not be missed
953 // when upgrading an application. On the other side, the user will be bugged every time he will switch between slic3r versions.
954 /*const auto existing_recommended = existing_idx.recommended(old_slic3r_version);
955 if (existing_recommended != existing_idx.end() && recommended->config_version == existing_recommended->config_version) {
956 // The user has already seen (and presumably rejected) this update
957 BOOST_LOG_TRIVIAL(info) << format("Downloaded index for `%1%` is the same as installed one, not offering an update.",idx.vendor());
958 continue;
959 }*/
960 } catch (const std::exception &err) {
961 BOOST_LOG_TRIVIAL(error) << format("Cannot load the installed index at `%1%`: %2%", bundle_path_idx, err.what());
962 }
963 }
964#if 0
965 // Check if the update is already present in a snapshot
966 if(!current_not_supported)
967 {
968 const auto recommended_snap = SnapshotDB::singleton().snapshot_with_vendor_preset(vp.name, recommended->config_version);
969 if (recommended_snap != SnapshotDB::singleton().end()) {
970 BOOST_LOG_TRIVIAL(info) << format("Bundle update %1% %2% already found in snapshot %3%, skipping...",
971 vp.name,
972 recommended->config_version.to_string(),
973 recommended_snap->id);
974 continue;
975 }
976 }
977#endif // 0
978 updates.updates.emplace_back(std::move(new_update));
979 // 'Install' the index in the vendor directory. This is used to memoize
980 // offered updates and to not offer the same update again if it was cancelled by the user.
981 copy_file_fix(bundle_path_idx_to_install, bundle_path_idx);
982 } else {
983 BOOST_LOG_TRIVIAL(warning) << format("Index for vendor %1% indicates update (%2%) but the new bundle was found neither in cache nor resources",
984 idx.vendor(),
985 recommended->config_version.to_string());
986 }
987 }
988
989 return updates;
990}
const_iterator recommended() const
Definition Version.cpp:229
const_iterator end() const
Definition Version.hpp:68
static VendorProfile from_ini(const boost::filesystem::path &path, bool load_all=true)
Definition Preset.cpp:76
UPDATE * new_update(int op, char *memtype, int filefmt, char *filename, unsigned section)
Definition update.c:201
static LISTID updates
Definition main.c:186
void show_error(wxWindow *parent, const wxString &message, bool monospaced_font)
Definition GUI.cpp:224
bool vendor_profile_has_all_resources(const VendorProfile &vp)
Definition Preset.cpp:2277
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:44
std::string to_string(const Vec2crd &pt)
Definition Point.hpp:139
S::iterator end(S &sh, const PathTag &)
Definition geometry_traits.hpp:620
static char error[256]
Definition tga.cpp:50

References Slic3r::VendorProfile::changelog_url, Slic3r::VendorProfile::config_version, Slic3r::GUI::Config::Index::end(), error, Slic3r::format(), Slic3r::VendorProfile::from_ini(), Slic3r::VendorProfile::id, Slic3r::GUI::Config::Index::load(), Slic3r::VendorProfile::name, new_update(), Slic3r::GUI::Config::Index::recommended(), Slic3r::GUI::show_error(), Slic3r::Semver::to_string(), updates, Slic3r::VendorProfile::valid(), and Slic3r::PresetUtils::vendor_profile_has_all_resources().

+ Here is the call graph for this function:

◆ get_file()

bool Slic3r::PresetUpdater::priv::get_file ( const std::string &  url,
const fs::path &  target_path 
) const
221{
222 bool res = false;
223 fs::path tmp_path = target_path;
224 tmp_path += format(".%1%%2%", get_current_pid(), TMP_EXTENSION);
225
226 BOOST_LOG_TRIVIAL(info) << format("Get: `%1%`\n\t-> `%2%`\n\tvia tmp path `%3%`",
227 url,
228 target_path.string(),
229 tmp_path.string());
230
231 Http::get(url)
232 .on_progress([](Http::Progress, bool &cancel) {
233 if (cancel) { cancel = true; }
234 })
235 .on_error([&](std::string body, std::string error, unsigned http_status) {
236 (void)body;
237 BOOST_LOG_TRIVIAL(error) << format("Error getting: `%1%`: HTTP %2%, %3%",
238 url,
239 http_status,
240 error);
241 })
242 .on_complete([&](std::string body, unsigned /* http_status */) {
243 fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc);
244 file.write(body.c_str(), body.size());
245 file.close();
246 fs::rename(tmp_path, target_path);
247 res = true;
248 })
249 .perform_sync();
250
251 return res;
252}
static Http get(std::string url)
Definition Http.cpp:607
Http & on_progress(ProgressFn fn)
Definition Http.cpp:571
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
unsigned get_current_pid()
Definition utils.cpp:924
static const char * TMP_EXTENSION
Definition PresetUpdater.cpp:53

References error, Slic3r::format(), Slic3r::Http::get(), Slic3r::get_current_pid(), Slic3r::Http::on_progress(), Slic3r::TMP_EXTENSION, and void().

+ Here is the call graph for this function:

◆ get_missing_resource()

void Slic3r::PresetUpdater::priv::get_missing_resource ( const std::string &  vendor,
const std::string &  filename,
const std::string &  url 
) const
265{
266 if (filename.empty() || vendor.empty())
267 return;
268
269 if (!boost::starts_with(url, "http://files.prusa3d.com/wp-content/uploads/repository/") &&
270 !boost::starts_with(url, "https://files.prusa3d.com/wp-content/uploads/repository/"))
271 {
272 throw Slic3r::CriticalException(GUI::format("URL outside prusa3d.com network: %1%", url));
273 }
274
275 std::string escaped_filename = escape_string_url(filename);
276 const fs::path file_in_vendor(vendor_path / (vendor + "/" + filename));
277 const fs::path file_in_rsrc(rsrc_path / (vendor + "/" + filename));
278 const fs::path file_in_cache(cache_path / (vendor + "/" + filename));
279
280 if (fs::exists(file_in_vendor)) { // Already in vendor. No need to do anything.
281 BOOST_LOG_TRIVIAL(info) << "Resource " << vendor << " / " << filename << " found in vendor folder. No need to download.";
282 return;
283 }
284 if (fs::exists(file_in_rsrc)) { // In resources dir since installation. No need to do anything.
285 BOOST_LOG_TRIVIAL(info) << "Resource " << vendor << " / " << filename << " found in resources folder. No need to download.";
286 return;
287 }
288 if (fs::exists(file_in_cache)) { // In cache/venodr_name/ dir. No need to do anything.
289 BOOST_LOG_TRIVIAL(info) << "Resource " << vendor << " / " << filename << " found in cache folder. No need to download.";
290 return;
291 }
292
293 BOOST_LOG_TRIVIAL(info) << "Resources check could not find " << vendor << " / " << filename << " bed texture. Downloading.";
294
295 const auto resource_url = format("%1%%2%%3%", url, url.back() == '/' ? "" : "/", escaped_filename); // vendor should already be in url
296
297 if (!fs::exists(file_in_cache.parent_path()))
298 fs::create_directory(file_in_cache.parent_path());
299
300 get_file(resource_url, file_in_cache);
301 return;
302}
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:56
std::string escape_string_url(const std::string &unescaped)
Definition PresetUpdater.cpp:72
bool get_file(const std::string &url, const fs::path &target_path) const
Definition PresetUpdater.cpp:220

References Slic3r::format(), and Slic3r::GUI::format().

+ Here is the call graph for this function:

◆ get_or_copy_missing_resource()

void Slic3r::PresetUpdater::priv::get_or_copy_missing_resource ( const std::string &  vendor,
const std::string &  filename,
const std::string &  url 
) const
305{
306 if (filename.empty() || vendor.empty())
307 return;
308
309 std::string escaped_filename = escape_string_url(filename);
310 const fs::path file_in_vendor(vendor_path / (vendor + "/" + filename));
311 const fs::path file_in_rsrc(rsrc_path / (vendor + "/" + filename));
312 const fs::path file_in_cache(cache_path / (vendor + "/" + filename));
313
314 if (fs::exists(file_in_vendor)) { // Already in vendor. No need to do anything.
315 BOOST_LOG_TRIVIAL(info) << "Resource " << vendor << " / " << filename << " found in vendor folder. No need to download.";
316 return;
317 }
318 if (fs::exists(file_in_rsrc)) { // In resources dir since installation. No need to do anything.
319 BOOST_LOG_TRIVIAL(info) << "Resource " << vendor << " / " << filename << " found in resources folder. No need to download.";
320 return;
321 }
322 if (!fs::exists(file_in_cache)) { // No file to copy. Download it to straight to the vendor dir.
323 if (!boost::starts_with(url, "http://files.prusa3d.com/wp-content/uploads/repository/") &&
324 !boost::starts_with(url, "https://files.prusa3d.com/wp-content/uploads/repository/"))
325 {
326 throw Slic3r::CriticalException(GUI::format("URL outside prusa3d.com network: %1%", url));
327 }
328 BOOST_LOG_TRIVIAL(info) << "Downloading resources missing in cache directory: " << vendor << " / " << filename;
329
330 const auto resource_url = format("%1%%2%%3%", url, url.back() == '/' ? "" : "/", escaped_filename); // vendor should already be in url
331
332 if (!fs::exists(file_in_vendor.parent_path()))
333 fs::create_directory(file_in_vendor.parent_path());
334
335 get_file(resource_url, file_in_vendor);
336 return;
337 }
338
339 if (!fs::exists(file_in_vendor.parent_path())) // create vendor_name dir in vendor
340 fs::create_directory(file_in_vendor.parent_path());
341
342 BOOST_LOG_TRIVIAL(debug) << "Copiing: " << file_in_cache << " to " << file_in_vendor;
343 copy_file_fix(file_in_cache, file_in_vendor);
344}

References Slic3r::format(), and Slic3r::GUI::format().

+ Here is the call graph for this function:

◆ perform_updates()

bool Slic3r::PresetUpdater::priv::perform_updates ( Updates &&  updates,
bool  snapshot = true 
) const
993{
994 if (updates.incompats.size() > 0) {
995 if (snapshot) {
996 BOOST_LOG_TRIVIAL(info) << "Taking a snapshot...";
997 if (! GUI::Config::take_config_snapshot_cancel_on_error(*GUI::wxGetApp().app_config, Snapshot::SNAPSHOT_DOWNGRADE, "",
998 _u8L("Continue and install configuration updates?")))
999 return false;
1000 }
1001
1002 BOOST_LOG_TRIVIAL(info) << format("Deleting %1% incompatible bundles", updates.incompats.size());
1003
1004 for (auto &incompat : updates.incompats) {
1005 BOOST_LOG_TRIVIAL(info) << '\t' << incompat;
1006 incompat.remove();
1007 }
1008
1009
1010 } else if (updates.updates.size() > 0) {
1011
1012 if (snapshot) {
1013 BOOST_LOG_TRIVIAL(info) << "Taking a snapshot...";
1014 if (! GUI::Config::take_config_snapshot_cancel_on_error(*GUI::wxGetApp().app_config, Snapshot::SNAPSHOT_UPGRADE, "",
1015 _u8L("Continue and install configuration updates?")))
1016 return false;
1017 }
1018
1019 BOOST_LOG_TRIVIAL(info) << format("Performing %1% updates", updates.updates.size());
1020
1021 wxProgressDialog progress_dialog(_L("Installing profiles"), _L("Installing profiles") , 100, nullptr, wxPD_AUTO_HIDE);
1022 progress_dialog.Pulse();
1023
1024 for (const auto &update : updates.updates) {
1025 BOOST_LOG_TRIVIAL(info) << '\t' << update;
1026
1027 update.install();
1028
1029 PresetBundle bundle;
1030 // Throw when parsing invalid configuration. Only valid configuration is supposed to be provided over the air.
1032
1033 BOOST_LOG_TRIVIAL(info) << format("Deleting %1% conflicting presets", bundle.prints.size() + bundle.filaments.size() + bundle.printers.size());
1034
1035 auto preset_remover = [](const Preset &preset) {
1036 BOOST_LOG_TRIVIAL(info) << '\t' << preset.file;
1037 fs::remove(preset.file);
1038 };
1039
1040 for (const auto &preset : bundle.prints) { preset_remover(preset); }
1041 for (const auto &preset : bundle.filaments) { preset_remover(preset); }
1042 for (const auto &preset : bundle.printers) { preset_remover(preset); }
1043
1044 // Also apply the `obsolete_presets` property, removing obsolete ini files
1045
1046 BOOST_LOG_TRIVIAL(info) << format("Deleting %1% obsolete presets",
1047 bundle.obsolete_presets.prints.size() + bundle.obsolete_presets.filaments.size() + bundle.obsolete_presets.printers.size());
1048
1049 auto obsolete_remover = [](const char *subdir, const std::string &preset) {
1050 auto path = fs::path(Slic3r::data_dir()) / subdir / preset;
1051 path += ".ini";
1052 BOOST_LOG_TRIVIAL(info) << '\t' << path.string();
1053 fs::remove(path);
1054 };
1055
1056 for (const auto &name : bundle.obsolete_presets.prints) { obsolete_remover("print", name); }
1057 for (const auto &name : bundle.obsolete_presets.filaments) { obsolete_remover("filament", name); }
1058 for (const auto &name : bundle.obsolete_presets.sla_prints) { obsolete_remover("sla_print", name); }
1059 for (const auto &name : bundle.obsolete_presets.sla_materials/*filaments*/) { obsolete_remover("sla_material", name); }
1060 for (const auto &name : bundle.obsolete_presets.printers) { obsolete_remover("printer", name); }
1061
1062 // check if any resorces of installed bundle are missing. If so, new ones should be already downloaded at cache/vendor_id/
1063 VendorProfile vp;
1064 try {
1065 vp = VendorProfile::from_ini(update.target, true);
1066 }
1067 catch (const std::exception& e) {
1068 BOOST_LOG_TRIVIAL(error) << format("Corrupted profile file for vendor %1%, message: %2%", update.target, e.what());
1069 continue;
1070 }
1071 progress_dialog.Update(1, GUI::format_wxstr(_L("Downloading resources for %1%."),vp.id));
1072 progress_dialog.Pulse();
1073 for (const auto& model : vp.models) {
1074 for (const std::string& resource : { model.bed_texture, model.bed_model, model.thumbnail }) {
1075 if (resource.empty())
1076 continue;
1077 try
1078 {
1079 get_or_copy_missing_resource(vp.id, resource, vp.config_update_url);
1080 }
1081 catch (const std::exception& e)
1082 {
1083 BOOST_LOG_TRIVIAL(error) << "Failed to prepare " << resource << " for " << vp.id << " " << model.id << ": " << e.what();
1084 }
1085 }
1086 }
1087 }
1088
1089 progress_dialog.Destroy();
1090 }
1091
1092 return true;
1093}
#define _u8L(s)
macro used to mark string used at localization, return same string
Definition SLAPrint.cpp:29
@ LoadSystem
Definition PresetBundle.hpp:115
bool take_config_snapshot_cancel_on_error(const AppConfig &app_config, Snapshot::Reason reason, const std::string &comment, const std::string &message, Snapshot const **psnapshot)
Definition Snapshot.cpp:589
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:42
@ Disable
Definition Config.hpp:219
#define _L(s)
Definition I18N.hpp:3
void get_or_copy_missing_resource(const std::string &vendor, const std::string &filename, const std::string &url) const
Definition PresetUpdater.cpp:304

References _L, _u8L, Slic3r::VendorProfile::config_update_url, Slic3r::data_dir(), Slic3r::Disable, error, Slic3r::PresetBundle::filaments, Slic3r::PresetBundle::ObsoletePresets::filaments, Slic3r::format(), Slic3r::GUI::format_wxstr(), Slic3r::VendorProfile::from_ini(), Slic3r::VendorProfile::id, Slic3r::PresetBundle::load_configbundle(), Slic3r::PresetBundle::LoadSystem, Slic3r::VendorProfile::models, Slic3r::PresetBundle::obsolete_presets, Slic3r::PresetBundle::printers, Slic3r::PresetBundle::ObsoletePresets::printers, Slic3r::PresetBundle::prints, Slic3r::PresetBundle::ObsoletePresets::prints, Slic3r::PresetCollection::size(), Slic3r::PresetBundle::ObsoletePresets::sla_materials, Slic3r::PresetBundle::ObsoletePresets::sla_prints, Slic3r::GUI::Config::take_config_snapshot_cancel_on_error(), and updates.

+ Here is the call graph for this function:

◆ prune_tmps()

void Slic3r::PresetUpdater::priv::prune_tmps ( ) const
256{
257 for (auto &dir_entry : boost::filesystem::directory_iterator(cache_path))
258 if (is_plain_file(dir_entry) && dir_entry.path().extension() == TMP_EXTENSION) {
259 BOOST_LOG_TRIVIAL(debug) << "Cache prune: " << dir_entry.path().string();
260 fs::remove(dir_entry.path());
261 }
262}
bool is_plain_file(const boost::filesystem::directory_entry &dir_entry)
Definition utils.cpp:761

References Slic3r::is_plain_file(), and Slic3r::TMP_EXTENSION.

+ Here is the call graph for this function:

◆ set_download_prefs()

void Slic3r::PresetUpdater::priv::set_download_prefs ( const AppConfig app_config)
213{
214 enabled_version_check = app_config->get("notify_release") != "none";
215 version_check_url = app_config->version_check_url();
216 enabled_config_update = app_config->get_bool("preset_update") && !app_config->legacy_datadir();
217}
bool enabled_config_update
Definition PresetUpdater.cpp:160
std::string version_check_url
Definition PresetUpdater.cpp:161
bool enabled_version_check
Definition PresetUpdater.cpp:159

References Slic3r::AppConfig::get(), Slic3r::AppConfig::get_bool(), Slic3r::AppConfig::legacy_datadir(), and Slic3r::AppConfig::version_check_url().

Referenced by priv().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_waiting_updates()

void Slic3r::PresetUpdater::priv::set_waiting_updates ( Updates  u)
1096{
1097 waiting_updates = u;
1098 has_waiting_updates = true;
1099}
bool has_waiting_updates
Definition PresetUpdater.cpp:171
Updates waiting_updates
Definition PresetUpdater.cpp:172

◆ sync_config()

void Slic3r::PresetUpdater::priv::sync_config ( const VendorMap  vendors,
const std::string &  index_archive_url 
)
349{
350 BOOST_LOG_TRIVIAL(info) << "Syncing configuration cache";
351
352 if (!enabled_config_update) { return; }
353
354 // Download profiles archive zip
355 // dk: Do we want to return here on error? Or skip archive dwnld and unzip and work with previous run state cache / vendor? I think return.
356 // Any error here also doesnt show any info in UI. Do we want maybe notification?
357 fs::path archive_path(cache_path / "vendor_indices.zip");
358 if (index_archive_url.empty()) {
359 BOOST_LOG_TRIVIAL(error) << "Downloading profile archive failed - url has no value.";
360 return;
361 }
362 BOOST_LOG_TRIVIAL(info) << "Downloading vedor profiles archive zip from " << index_archive_url;
363 //check if idx_url is leading to our site
364 if (!boost::starts_with(index_archive_url, "http://files.prusa3d.com/wp-content/uploads/repository/") &&
365 !boost::starts_with(index_archive_url, "https://files.prusa3d.com/wp-content/uploads/repository/"))
366 {
367 BOOST_LOG_TRIVIAL(error) << "Unsafe url path for vedor profiles archive zip. Download is rejected.";
368 return;
369 }
370 if (!get_file(index_archive_url, archive_path)) {
371 BOOST_LOG_TRIVIAL(error) << "Download of vedor profiles archive zip failed.";
372 return;
373 }
374 if (cancel) {
375 return;
376 }
377
378 enum class VendorStatus
379 {
381 IN_CACHE,
382 NEW_VERSION,
383 INSTALLED
384 };
385
386 std::vector<std::pair<std::string, VendorStatus>> vendors_with_status;
387 // Unzip archive to cache / vendor
388 mz_zip_archive archive;
389 mz_zip_zero_struct(&archive);
390 if (!open_zip_reader(&archive, archive_path.string())) {
391 BOOST_LOG_TRIVIAL(error) << "Couldn't open zipped bundle.";
392 return;
393 } else {
394 mz_uint num_entries = mz_zip_reader_get_num_files(&archive);
395 // loop the entries
397 for (mz_uint i = 0; i < num_entries; ++i) {
398 if (mz_zip_reader_file_stat(&archive, i, &stat)) {
399 std::string name(stat.m_filename);
400 if (stat.m_uncomp_size > 0) {
401 std::string buffer((size_t)stat.m_uncomp_size, 0);
402 mz_bool res = mz_zip_reader_extract_to_mem(&archive, stat.m_file_index, (void*)buffer.data(), (size_t)stat.m_uncomp_size, 0);
403 if (res == 0) {
404 BOOST_LOG_TRIVIAL(error) << "Failed to unzip " << stat.m_filename;
405 continue;
406 }
407 // create file from buffer
408 fs::path tmp_path(cache_vendor_path / (name + ".tmp"));
409 if (!fs::exists(tmp_path.parent_path())) {
410 BOOST_LOG_TRIVIAL(error) << "Failed to unzip file " << name << ". Directories are not supported. Skipping file.";
411 continue;
412 }
413 fs::path target_path(cache_vendor_path / name);
414 fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc);
415 file.write(buffer.c_str(), buffer.size());
416 file.close();
417 boost::system::error_code ec;
418 bool exists = fs::exists(tmp_path, ec);
419 if(!exists || ec) {
420 BOOST_LOG_TRIVIAL(error) << "Failed to find unzipped file at " << tmp_path << ". Terminating Preset updater synchorinzation." ;
421 close_zip_reader(&archive);
422 return;
423 }
424 fs::rename(tmp_path, target_path, ec);
425 if (ec) {
426 BOOST_LOG_TRIVIAL(error) << "Failed to rename unzipped file at " << tmp_path << ". Terminating Preset updater synchorinzation. Error message: " << ec.message();
427 close_zip_reader(&archive);
428 return;
429 }
430 // TODO: what if unexpected happens here (folder inside zip) - crash!
431
432 if (name.substr(name.size() - 3) == "idx")
433 vendors_with_status.emplace_back(name.substr(0, name.size() - 4), VendorStatus::IN_ARCHIVE); // asume for now its only in archive - if not, it will change later.
434 }
435 }
436 }
437 close_zip_reader(&archive);
438 }
439
440 // Update vendor preset bundles if in Vendor
441 // Over all indices from the cache directory:
442 for (auto &index : index_db) {
443 if (cancel) {
444 return;
445 }
446 auto archive_it = std::find_if(vendors_with_status.begin(), vendors_with_status.end(),
447 [&index](const std::pair<std::string, VendorStatus>& element) { return element.first == index.vendor(); });
448 //assert(archive_it != vendors_with_status.end()); // this would mean there is a index for vendor that is missing in recently downloaded archive
449
450 const auto vendor_it = vendors.find(index.vendor());
451 if (vendor_it == vendors.end()) {
452 // Not installed vendor yet we need to check missing thumbnails (of new printers)
453 BOOST_LOG_TRIVIAL(debug) << "No such vendor: " << index.vendor();
454 if (archive_it != vendors_with_status.end())
455 archive_it->second = VendorStatus::IN_CACHE;
456 continue;
457 }
458
459 if (archive_it != vendors_with_status.end())
460 archive_it->second = VendorStatus::INSTALLED;
461
462 const VendorProfile &vendor = vendor_it->second;
463 const std::string idx_path = (cache_path / (vendor.id + ".idx")).string();
464 const std::string idx_path_temp = (cache_vendor_path / (vendor.id + ".idx")).string();
465
466 // Load the fresh index up
467 {
468 Index new_index;
469 try {
470 new_index.load(idx_path_temp);
471 } catch (const std::exception & /* err */) {
472 BOOST_LOG_TRIVIAL(error) << format("Could not load downloaded index %1% for vendor %2%: invalid index?", idx_path_temp, vendor.name);
473 continue;
474 }
475 if (new_index.version() < index.version()) {
476 BOOST_LOG_TRIVIAL(info) << format("The downloaded index %1% for vendor %2% is older than the active one. Ignoring the downloaded index.", idx_path_temp, vendor.name);
477 continue;
478 }
479 copy_file_fix(idx_path_temp, idx_path);
480
481 //if we rename path we need to change it in Index object too or create the object again
482 //index = std::move(new_index);
483 try {
484 index.load(idx_path);
485 }
486 catch (const std::exception& /* err */) {
487 BOOST_LOG_TRIVIAL(error) << format("Could not load downloaded index %1% for vendor %2%: invalid index?", idx_path, vendor.name);
488 continue;
489 }
490 if (cancel)
491 return;
492 }
493
494 // See if a there's a new version to download
495 const auto recommended_it = index.recommended();
496 if (recommended_it == index.end()) {
497 BOOST_LOG_TRIVIAL(error) << format("No recommended version for vendor: %1%, invalid index?", vendor.name);
498 continue;
499 }
500
501 const auto recommended = recommended_it->config_version;
502
503 BOOST_LOG_TRIVIAL(debug) << format("Got index for vendor: %1%: current version: %2%, recommended version: %3%",
504 vendor.name,
505 vendor.config_version.to_string(),
506 recommended.to_string());
507
508 if (vendor.config_version >= recommended) { continue; }
509
510 // vendors that are checked here, doesnt need to be checked again later
511 if (archive_it != vendors_with_status.end())
512 archive_it->second = VendorStatus::NEW_VERSION;
513
514 // Download recomended ini to cache
515 const auto path_in_cache = cache_path / (vendor.id + ".ini");
516 BOOST_LOG_TRIVIAL(info) << "Downloading new bundle for vendor: " << vendor.name;
517 const auto bundle_url = format("%1%/%2%.ini", vendor.config_update_url, recommended.to_string());
518 const auto bundle_path = cache_path / (vendor.id + ".ini");
519 if (!get_file(bundle_url, bundle_path))
520 continue;
521 if (cancel)
522 return;
523 // vp is fully loaded to get all resources
524 VendorProfile vp;
525 try {
526 vp = VendorProfile::from_ini(bundle_path, true);
527 } catch (const std::exception& e) {
528 BOOST_LOG_TRIVIAL(error) << format("Corrupted profile file for vendor %1% at %2%, message: %3%", vendor.id, bundle_path, e.what());
529 continue;
530 }
531 // check the fresh bundle for missing resources
532 // for that, the ini file must be parsed (done above)
533 for (const auto& model : vp.models) {
534 for (const std::string& res : { model.bed_texture, model.bed_model, model.thumbnail/*id +"_thumbnail.png"*/} ) {
535 if (! res.empty()) {
536 try
537 {
538 get_missing_resource(vp.id, res, vendor.config_update_url);
539 }
540 catch (const std::exception& e)
541 {
542 BOOST_LOG_TRIVIAL(error) << "Failed to get " << res << " for " << vp.id << " " << model.id << ": " << e.what();
543 }
544
545 }
546 if (cancel)
547 return;
548 }
549 }
550 }
551 // Download missing thumbnails for not-installed vendors.
552 //for (const std::string& vendor : vendors_only_in_archive)
553 for (const std::pair<std::string, VendorStatus >& vendor : vendors_with_status) {
554 if (vendor.second == VendorStatus::IN_ARCHIVE) {
555 // index in archive and not in cache and not installed vendor
556
557 const auto idx_path_in_archive = cache_vendor_path / (vendor.first + ".idx");
558 const auto ini_path_in_archive = cache_vendor_path / (vendor.first + ".ini");
559 if (!fs::exists(idx_path_in_archive))
560 continue;
561 Index index;
562 try {
563 index.load(idx_path_in_archive);
564 }
565 catch (const std::exception& /* err */) {
566 BOOST_LOG_TRIVIAL(error) << format("Could not load downloaded index %1% for vendor %2%: invalid index?", idx_path_in_archive, vendor.first);
567 continue;
568 }
569 const auto recommended_it = index.recommended();
570 if (recommended_it == index.end()) {
571 BOOST_LOG_TRIVIAL(error) << format("No recommended version for vendor: %1%, invalid index? (%2%)", vendor.first, idx_path_in_archive);
572 continue;
573 }
574 const auto recommended = recommended_it->config_version;
575 if (!fs::exists(ini_path_in_archive)){
576 // Download recommneded to vendor - we do not have any existing ini file so we have to use hardcoded url.
577 const std::string fixed_url = GUI::wxGetApp().app_config->profile_folder_url();
578 const auto bundle_url = format("%1%/%2%/%3%.ini", fixed_url, vendor.first, recommended.to_string());
579 if (!get_file(bundle_url, ini_path_in_archive))
580 continue;
581 } else {
582 // check existing ini version
583 // then download recommneded to vendor if needed
584 VendorProfile vp;
585 try {
586 vp = VendorProfile::from_ini(ini_path_in_archive, true);
587 } catch (const std::exception& e) {
588 BOOST_LOG_TRIVIAL(error) << format("Corrupted profile file for vendor %1% at %2%, message: %3%", vendor.first, ini_path_in_archive, e.what());
589 continue;
590 }
591 if (vp.config_version != recommended) {
592 const std::string fixed_url = GUI::wxGetApp().app_config->profile_folder_url();
593 const auto bundle_url = format("%1%/%2%/%3%.ini", fixed_url, vendor.first, recommended.to_string());
594 if (!get_file(bundle_url, ini_path_in_archive))
595 continue;
596 }
597 }
598 // check missing thumbnails
599 VendorProfile vp;
600 try {
601 vp = VendorProfile::from_ini(ini_path_in_archive, true);
602 }
603 catch (const std::exception& e) {
604 BOOST_LOG_TRIVIAL(error) << format("Corrupted profile file for vendor %1% at %2%, message: %3%", vendor.first, ini_path_in_archive, e.what());
605 continue;
606 }
607 for (const auto& model : vp.models) {
608 if (!model.thumbnail.empty()) {
609 try
610 {
611 get_missing_resource(vp.id, model.thumbnail, vp.config_update_url);
612 }
613 catch (const std::exception& e)
614 {
615 BOOST_LOG_TRIVIAL(error) << "Failed to get " << model.thumbnail << " for " << vp.id << " " << model.id << ": " << e.what();
616 }
617 }
618 if (cancel)
619 return;
620 }
621 } else if (vendor.second == VendorStatus::IN_CACHE) {
622 // find those where archive index recommends other version than index in cache and get it if not present
623 const auto idx_path_in_archive = cache_vendor_path / (vendor.first + ".idx");
624 const auto ini_path_in_archive = cache_vendor_path / (vendor.first + ".ini");
625 const auto idx_path_in_cache = cache_path / (vendor.first + ".idx");
626
627 if (!fs::exists(idx_path_in_archive) || !fs::exists(idx_path_in_cache))
628 continue;
629
630 // Compare index in cache and recetly downloaded one as part of zip archive
631 Index index_cache;
632 try {
633 index_cache.load(idx_path_in_cache);
634 }
635 catch (const std::exception& /* err */) {
636 BOOST_LOG_TRIVIAL(error) << format("Could not load downloaded index %1% for vendor %2%: invalid index?", idx_path_in_cache, vendor.first);
637 continue;
638 }
639 const auto recommended_it_cache = index_cache.recommended();
640 if (recommended_it_cache == index_cache.end()) {
641 BOOST_LOG_TRIVIAL(error) << format("No recommended version for vendor: %1%, invalid index? (%2%)", vendor.first, idx_path_in_cache);
642 continue;
643 }
644 const auto recommended_cache = recommended_it_cache->config_version;
645
646 Index index_archive;
647 try {
648 index_archive.load(idx_path_in_archive);
649 }
650 catch (const std::exception& /* err */) {
651 BOOST_LOG_TRIVIAL(error) << format("Could not load downloaded index %1% for vendor %2%: invalid index?", idx_path_in_archive, vendor.first);
652 continue;
653 }
654 const auto recommended_it_archive = index_archive.recommended();
655 if (recommended_it_archive == index_archive.end()) {
656 BOOST_LOG_TRIVIAL(error) << format("No recommended version for vendor: %1%, invalid index? (%2%)", vendor.first, idx_path_in_archive);
657 continue;
658 }
659 const auto recommended_archive = recommended_it_archive->config_version;
660
661 if (recommended_archive <= recommended_cache) {
662 // There isn't more recent recomended version online. This vendor is also not istalled.
663 // Thus only .ini is in resources and came with installation.
664 // And we expect all resources are present.
665 continue;
666 }
667
668 // Download new .ini if needed. So next time user runs Wizard, most recent profiles are shown & installed.
669 if (!fs::exists(ini_path_in_archive) || fs::is_empty(ini_path_in_archive)) {
670 // download recommneded to vendor
671 const fs::path ini_path_in_rsrc = rsrc_path / (vendor.first + ".ini");
672 if (!fs::exists(ini_path_in_rsrc)) {
673 // THIS SHOULD NOT HAPPEN
674 continue;
675 }
676 // Get download path from existing ini.
677 VendorProfile vp;
678 try {
679 vp = VendorProfile::from_ini(ini_path_in_rsrc, false);
680 }
681 catch (const std::exception& e) {
682 BOOST_LOG_TRIVIAL(error) << format("Corrupted profile file for vendor %1% at %2%, message: %3%", vendor.first, ini_path_in_rsrc, e.what());
683 continue;
684 }
685 const auto bundle_url = format("%1%/%2%.ini", vp.config_update_url, recommended_archive.to_string());
686 if (!get_file(bundle_url, ini_path_in_archive)) {
687 BOOST_LOG_TRIVIAL(error) << format("Failed to open vendor .ini file when checking missing resources: %1%", ini_path_in_rsrc);
688 continue;
689 }
690 } else {
691 // Check existing ini version.
692 // Then download recommneded to vendor if needed.
693 VendorProfile vp;
694 try {
695 vp = VendorProfile::from_ini(ini_path_in_archive, false);
696 }
697 catch (const std::exception& e) {
698 BOOST_LOG_TRIVIAL(error) << format("Corrupted profile file for vendor %1% at %2%, message: %3%", vendor.first, ini_path_in_archive, e.what());
699 continue;
700 }
701 if (vp.config_version != recommended_archive) {
702 const auto bundle_url = format("%1%/%2%.ini", vp.config_update_url, recommended_archive.to_string());
703 if (!get_file(bundle_url, ini_path_in_archive)) {
704 BOOST_LOG_TRIVIAL(error) << format("Failed to open vendor .ini file when checking missing resources: %1%", ini_path_in_archive);
705 continue;
706 }
707 }
708 }
709
710 if (!fs::exists(ini_path_in_archive)) {
711 BOOST_LOG_TRIVIAL(error) << "Resources check failed to find ini file for vendor: " << vendor.first;
712 continue;
713 }
714 // check missing thumbnails
715 VendorProfile vp;
716 try {
717 vp = VendorProfile::from_ini(ini_path_in_archive, true);
718 }
719 catch (const std::exception& e) {
720 BOOST_LOG_TRIVIAL(error) << format("Corrupted profile file for vendor %1% at %2%, message: %3%", vendor.first, ini_path_in_archive, e.what());
721 continue;
722 }
723 for (const auto& model : vp.models) {
724 if (!model.thumbnail.empty()) {
725 try
726 {
727 get_missing_resource(vp.id, model.thumbnail, vp.config_update_url);
728 }
729 catch (const std::exception& e)
730 {
731 BOOST_LOG_TRIVIAL(error) << "Failed to get " << model.thumbnail << " for " << vp.id << " " << model.id << ": " << e.what();
732 }
733 }
734 if (cancel)
735 return;
736 }
737 } else if (vendor.second == VendorStatus::INSTALLED || vendor.second == VendorStatus::NEW_VERSION) {
738 // Installed vendors need to check that no resource is missing. Do this only for files in vendor folder (not in resorces)
739 // VendorStatus::NEW_VERSION might seem like a mistake here since files are downloaded when preparing update higher in this function.
740 // But this is a check for ini file in vendor where resources might be still missing since last update.
741 const auto path_in_vendor = vendor_path / (vendor.first + ".ini");
742 if(!fs::exists(path_in_vendor))
743 continue;
744 VendorProfile vp;
745 try {
746 vp = VendorProfile::from_ini(path_in_vendor, true);
747 }
748 catch (const std::exception& e) {
749 BOOST_LOG_TRIVIAL(error) << format("Corrupted profile file for vendor %1% at %2%, message: %3%", vendor.first, path_in_vendor, e.what());
750 continue;
751 }
752 for (const auto& model : vp.models) {
753 for (const std::string& res : { model.bed_texture, model.bed_model, model.thumbnail }) {
754 if (!model.thumbnail.empty()) {
755 try
756 {
757 get_or_copy_missing_resource(vp.id, res, vp.config_update_url);
758 }
759 catch (const std::exception& e)
760 {
761 BOOST_LOG_TRIVIAL(error) << "Failed to get " << model.thumbnail << " for " << vp.id << " " << model.id << ": " << e.what();
762 }
763 }
764 if (cancel)
765 return;
766 }
767 }
768 }
769 }
770}
int exists(char *filename)
Definition loaddrv.c:45
mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip)
Definition miniz.c:7870
void mz_zip_zero_struct(mz_zip_archive *pZip)
Definition miniz.c:3792
mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags)
Definition miniz.c:4528
mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat)
Definition miniz.c:7959
unsigned int mz_uint
Definition miniz.h:489
int mz_bool
Definition miniz.h:492
Definition miniz.h:1053
Definition miniz.h:924
@ IN_ARCHIVE
Definition ConfigWizard_private.hpp:63
bool open_zip_reader(mz_zip_archive *zip, const std::string &fname)
Definition miniz_extension.cpp:62
bool close_zip_reader(mz_zip_archive *zip)
Definition miniz_extension.cpp:72
void get_missing_resource(const std::string &vendor, const std::string &filename, const std::string &url) const
Definition PresetUpdater.cpp:264
#define stat
Definition unistd.h:53

References Slic3r::close_zip_reader(), Slic3r::VendorProfile::config_update_url, Slic3r::VendorProfile::config_version, Slic3r::GUI::Config::Index::end(), error, exists(), Slic3r::format(), Slic3r::VendorProfile::from_ini(), Slic3r::VendorProfile::id, Slic3r::GUI::Config::Index::load(), Slic3r::VendorProfile::models, mz_zip_reader_extract_to_mem(), mz_zip_reader_file_stat(), mz_zip_reader_get_num_files(), mz_zip_zero_struct(), Slic3r::VendorProfile::name, Slic3r::open_zip_reader(), Slic3r::GUI::Config::Index::recommended(), stat, Slic3r::Semver::to_string(), and Slic3r::GUI::Config::Index::version().

+ Here is the call graph for this function:

◆ update_index_db()

void Slic3r::PresetUpdater::priv::update_index_db ( )
207{
208 index_db = Index::load_db();
209}

Member Data Documentation

◆ cache_path

fs::path Slic3r::PresetUpdater::priv::cache_path

◆ cache_vendor_path

fs::path Slic3r::PresetUpdater::priv::cache_vendor_path

◆ cancel

bool Slic3r::PresetUpdater::priv::cancel

◆ enabled_config_update

bool Slic3r::PresetUpdater::priv::enabled_config_update

◆ enabled_version_check

bool Slic3r::PresetUpdater::priv::enabled_version_check

◆ has_waiting_updates

bool Slic3r::PresetUpdater::priv::has_waiting_updates { false }

◆ index_db

std::vector<Index> Slic3r::PresetUpdater::priv::index_db

Referenced by priv().

◆ rsrc_path

fs::path Slic3r::PresetUpdater::priv::rsrc_path

◆ thread

std::thread Slic3r::PresetUpdater::priv::thread

◆ vendor_path

fs::path Slic3r::PresetUpdater::priv::vendor_path

◆ version_check_url

std::string Slic3r::PresetUpdater::priv::version_check_url

◆ waiting_updates

Updates Slic3r::PresetUpdater::priv::waiting_updates

The documentation for this struct was generated from the following file: