From 237eaa5f6f49bee0276c40ccc6fd85f1911831f2 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Thu, 3 Jan 2019 13:25:56 +0100 Subject: [PATCH] Fix #1526 --datadir not working --- src/libslic3r/PrintConfig.cpp | 7 +++++++ src/libslic3r/PrintConfig.hpp | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 215b174812..7da839dc37 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3118,6 +3118,13 @@ CLIConfigDef::CLIConfigDef() const CLIConfigDef cli_config_def; DynamicPrintAndCLIConfig::PrintAndCLIConfigDef DynamicPrintAndCLIConfig::s_def; +void DynamicPrintAndCLIConfig::handle_legacy(t_config_option_key &opt_key, std::string &value) const +{ + if (cli_config_def.options.find(opt_key) == cli_config_def.options.end()) { + PrintConfigDef::handle_legacy(opt_key, value); + } +} + std::ostream& print_cli_options(std::ostream& out) { for (const auto& opt : cli_config_def.options) { diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 08f42f39ba..8713ed03f0 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1171,6 +1171,12 @@ public: const ConfigDef* def() const override { return &s_def; } t_config_option_keys keys() const override { return s_def.keys(); } + // Verify whether the opt_key has not been obsoleted or renamed. + // Both opt_key and value may be modified by handle_legacy(). + // If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by handle_legacy(). + // handle_legacy() is called internally by set_deserialize(). + void handle_legacy(t_config_option_key &opt_key, std::string &value) const override; + private: class PrintAndCLIConfigDef : public ConfigDef {