From b1a7ac07c93fce30fd90054e2f7cb2d2daa2f65e Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 3 Jan 2019 16:36:45 +0100 Subject: [PATCH] Fix of "System presets listed among user presets (and can't be deleted) [1.42.0-alpha1] #1511" When loading a user provided Config Bundle (not a vendor Config Bundle), profiles of the same name as the system profiles already loaded into Slic3r will be ignored, while emiting an error message into the log. Also when loading a user provided Config Bundle, imported vs. overwritten profiles are reported into the log as well. --- src/slic3r/GUI/PresetBundle.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/slic3r/GUI/PresetBundle.cpp b/src/slic3r/GUI/PresetBundle.cpp index ee7ba279f..274f2a7ef 100644 --- a/src/slic3r/GUI/PresetBundle.cpp +++ b/src/slic3r/GUI/PresetBundle.cpp @@ -1164,6 +1164,22 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla section.first << "\" has already been loaded from another Confing Bundle."; continue; } + } else if ((flags & LOAD_CFGBNDLE_SYSTEM) == 0) { + // This is a user config bundle. + const Preset *existing = presets->find_preset(preset_name, false); + if (existing != nullptr) { + if (existing->is_system) { + assert(existing->vendor != nullptr); + BOOST_LOG_TRIVIAL(error) << "Error in a user provided Config Bundle \"" << path << "\": The " << presets->name() << " preset \"" << + existing->name << "\" is a system preset of vendor " << existing->vendor->name << " and it will be ignored."; + continue; + } else { + assert(existing->vendor == nullptr); + BOOST_LOG_TRIVIAL(trace) << "A " << presets->name() << " preset \"" << existing->name << "\" was overwritten with a preset from user Config Bundle \"" << path << "\""; + } + } else { + BOOST_LOG_TRIVIAL(trace) << "A new " << presets->name() << " preset \"" << preset_name << "\" was imported from user Config Bundle \"" << path << "\""; + } } // Decide a full path to this .ini file. auto file_name = boost::algorithm::iends_with(preset_name, ".ini") ? preset_name : preset_name + ".ini";