diff options
Diffstat (limited to 'src/libslic3r')
-rw-r--r-- | src/libslic3r/Preset.cpp | 2 | ||||
-rw-r--r-- | src/libslic3r/PresetBundle.cpp | 22 | ||||
-rw-r--r-- | src/libslic3r/PresetBundle.hpp | 2 |
3 files changed, 17 insertions, 9 deletions
diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 65027a390..2397a7d19 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1391,7 +1391,7 @@ const Preset* PrinterPresetCollection::find_system_preset_by_model_and_variant(c bool PrinterPresetCollection::only_default_printers() const { for (const auto& printer : get_presets()) { - if (!boost::starts_with(printer.name,"- default")) + if (! printer.is_default) return false; } return true; diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index b6e7fbd5e..81983b4aa 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -209,9 +209,16 @@ static void copy_dir(const boost::filesystem::path& from_dir, const boost::files } } -void PresetBundle::copy_files(const std::string& from) +// 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. +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"); // 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); @@ -220,7 +227,6 @@ void PresetBundle::copy_files(const std::string& from) from_data_dir / "shapes", #ifdef SLIC3R_PROFILE_USE_PRESETS_SUBDIR // Store the print/filament/printer presets into a "presets" directory. - data_dir / "presets", data_dir / "presets" / "print", data_dir / "presets" / "filament", data_dir / "presets" / "sla_print", @@ -1235,11 +1241,13 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_configbundle( // 1) Read the complete config file into a boost::property_tree. namespace pt = boost::property_tree; pt::ptree tree; - boost::nowide::ifstream ifs(path); - try { - pt::read_ini(ifs, tree); - } catch (const boost::property_tree::ini_parser::ini_parser_error &err) { - throw Slic3r::RuntimeError(format("Failed loading config bundle \"%1%\"\nError: \"%2%\" at line %3%", path, err.message(), err.line()).c_str()); + { + boost::nowide::ifstream ifs(path); + try { + pt::read_ini(ifs, tree); + } catch (const boost::property_tree::ini_parser::ini_parser_error &err) { + throw Slic3r::RuntimeError(format("Failed loading config bundle \"%1%\"\nError: \"%2%\" at line %3%", path, err.message(), err.line()).c_str()); + } } const VendorProfile *vendor_profile = nullptr; diff --git a/src/libslic3r/PresetBundle.hpp b/src/libslic3r/PresetBundle.hpp index a975e37fe..2a5ce6839 100644 --- a/src/libslic3r/PresetBundle.hpp +++ b/src/libslic3r/PresetBundle.hpp @@ -24,7 +24,7 @@ public: void reset(bool delete_files); void setup_directories(); - void copy_files(const std::string& from); + void import_newer_configs(const std::string& from); struct PresetPreferences { std::string printer_model_id;// name of a preferred printer model |