Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVojtech Bubnik <bubnikv@gmail.com>2021-12-15 18:09:16 +0300
committerVojtech Bubnik <bubnikv@gmail.com>2021-12-15 18:09:22 +0300
commit2dc461719f44acbc7b967f8ca159373b0ed34b41 (patch)
tree9a504ec1dccda8b21b3b17a002fdb45f9dab9bc5
parent5579b31a2638baf0a42cb3d891bb363fbe161255 (diff)
Importing newer config when starting the application:
Cache directory is newly deleted before it is imported from the newer config location. Linux specific: When asking for certificate directory, perform import of configs first.
-rw-r--r--src/libslic3r/PresetBundle.cpp14
-rw-r--r--src/slic3r/GUI/GUI_App.cpp41
2 files changed, 32 insertions, 23 deletions
diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp
index 81983b4aa..b6ac1a51b 100644
--- a/src/libslic3r/PresetBundle.cpp
+++ b/src/libslic3r/PresetBundle.cpp
@@ -212,17 +212,27 @@ static void copy_dir(const boost::filesystem::path& from_dir, const boost::files
// Import newer configuration from alternate PrusaSlicer configuration directory.
// AppConfig from the alternate location is already loaded.
// User profiles are being merged (old files are not being deleted),
-// while old system bundles are being deleted before newer are copied.
+// while old vendors and cache folders are being deleted before newer are copied.
void PresetBundle::import_newer_configs(const std::string& from)
{
boost::filesystem::path data_dir = boost::filesystem::path(Slic3r::data_dir());
// Clean-up vendors from the target directory, as the existing vendors will not be referenced
// by the copied PrusaSlicer.ini
- boost::filesystem::remove_all(data_dir / "vendor");
+ try {
+ boost::filesystem::remove_all(data_dir / "cache");
+ } catch (const std::exception &ex) {
+ BOOST_LOG_TRIVIAL(error) << "Error deleting old cache " << (data_dir / "cache").string();
+ }
+ try {
+ boost::filesystem::remove_all(data_dir / "vendor");
+ } catch (const std::exception &ex) {
+ BOOST_LOG_TRIVIAL(error) << "Error deleting old vendors " << (data_dir / "vendor").string();
+ }
// list of searched paths based on current directory system in setup_directories()
// do not copy cache and snapshots
boost::filesystem::path from_data_dir = boost::filesystem::path(from);
std::initializer_list<boost::filesystem::path> from_dirs= {
+ from_data_dir / "cache",
from_data_dir / "vendor",
from_data_dir / "shapes",
#ifdef SLIC3R_PROFILE_USE_PRESETS_SUBDIR
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index 0436ab1e6..0a4aa4bff 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -1078,27 +1078,6 @@ bool GUI_App::on_init_inner()
// Slic3r::debugf "wxWidgets version %s, Wx version %s\n", wxVERSION_STRING, wxVERSION;
-
- if (is_editor()) {
- std::string msg = Http::tls_global_init();
- std::string ssl_cert_store = app_config->get("tls_accepted_cert_store_location");
- bool ssl_accept = app_config->get("tls_cert_store_accepted") == "yes" && ssl_cert_store == Http::tls_system_cert_store();
-
- if (!msg.empty() && !ssl_accept) {
- RichMessageDialog
- dlg(nullptr,
- wxString::Format(_L("%s\nDo you want to continue?"), msg),
- "PrusaSlicer", wxICON_QUESTION | wxYES_NO);
- dlg.ShowCheckBox(_L("Remember my choice"));
- if (dlg.ShowModal() != wxID_YES) return false;
-
- app_config->set("tls_cert_store_accepted",
- dlg.IsCheckBoxChecked() ? "yes" : "no");
- app_config->set("tls_accepted_cert_store_location",
- dlg.IsCheckBoxChecked() ? Http::tls_system_cert_store() : "");
- }
- }
-
// !!! Initialization of UI settings as a language, application color mode, fonts... have to be done before first UI action.
// Like here, before the show InfoDialog in check_older_app_config()
@@ -1136,6 +1115,26 @@ bool GUI_App::on_init_inner()
NppDarkMode::SetSystemMenuForApp(new_sys_menu_enabled);
#endif
+ if (is_editor()) {
+ std::string msg = Http::tls_global_init();
+ std::string ssl_cert_store = app_config->get("tls_accepted_cert_store_location");
+ bool ssl_accept = app_config->get("tls_cert_store_accepted") == "yes" && ssl_cert_store == Http::tls_system_cert_store();
+
+ if (!msg.empty() && !ssl_accept) {
+ RichMessageDialog
+ dlg(nullptr,
+ wxString::Format(_L("%s\nDo you want to continue?"), msg),
+ "PrusaSlicer", wxICON_QUESTION | wxYES_NO);
+ dlg.ShowCheckBox(_L("Remember my choice"));
+ if (dlg.ShowModal() != wxID_YES) return false;
+
+ app_config->set("tls_cert_store_accepted",
+ dlg.IsCheckBoxChecked() ? "yes" : "no");
+ app_config->set("tls_accepted_cert_store_location",
+ dlg.IsCheckBoxChecked() ? Http::tls_system_cert_store() : "");
+ }
+ }
+
SplashScreen* scrn = nullptr;
if (app_config->get("show_splash_screen") == "1") {
// make a bitmap with dark grey banner on the left side