mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 00:31:11 -06:00
Looks like the reworked C++ preferences start to work again.
This commit is contained in:
parent
95c284c764
commit
e8b6d92d4d
26 changed files with 469 additions and 512 deletions
|
@ -207,15 +207,15 @@ public:
|
|||
void resize(size_t n, const ConfigOption *opt_default = nullptr) override
|
||||
{
|
||||
assert(opt_default == nullptr || opt_default->is_vector());
|
||||
assert(opt_default == nullptr || dynamic_cast<ConfigOptionVector<T>>(opt_default));
|
||||
// assert(opt_default == nullptr || dynamic_cast<ConfigOptionVector<T>>(opt_default));
|
||||
assert(! this->values.empty() || opt_default != nullptr);
|
||||
if (n == 0)
|
||||
this->values.clear();
|
||||
else if (n < this->values.size())
|
||||
this->values.erase(this->values.begin() + n, this->values.end());
|
||||
else if (n > this->values.size())
|
||||
else if (n > this->values.size()) {
|
||||
if (this->values.empty()) {
|
||||
if (opt_default == nullptr) {
|
||||
if (opt_default == nullptr)
|
||||
throw std::runtime_error("ConfigOptionVector::resize(): No default value provided.");
|
||||
if (opt_default->type() != this->type())
|
||||
throw std::runtime_error("ConfigOptionVector::resize(): Extending with an incompatible type.");
|
||||
|
|
|
@ -25,7 +25,6 @@ std::string config_path(const std::string &file_name);
|
|||
// The suffix ".ini" will be added if it is missing in the name.
|
||||
std::string config_path(const std::string §ion, const std::string &name);
|
||||
|
||||
extern std::locale locale_utf8;
|
||||
extern std::string encode_path(const char *src);
|
||||
extern std::string decode_path(const char *src);
|
||||
extern std::string normalize_utf8_nfc(const char *src);
|
||||
|
|
|
@ -103,14 +103,14 @@ const std::string& data_dir()
|
|||
|
||||
std::string config_path(const std::string &file_name)
|
||||
{
|
||||
auto file = boost::filesystem::canonical(boost::filesystem::path(g_data_dir) / file_name).make_preferred();
|
||||
auto file = (boost::filesystem::path(g_data_dir) / file_name).make_preferred();
|
||||
return file.string();
|
||||
}
|
||||
|
||||
std::string config_path(const std::string §ion, const std::string &name)
|
||||
{
|
||||
auto file_name = boost::algorithm::iends_with(name, ".ini") ? name : name + ".ini";
|
||||
auto file = boost::filesystem::canonical(boost::filesystem::path(g_data_dir) / file_name).make_preferred();
|
||||
auto file = (boost::filesystem::path(g_data_dir) / section / file_name).make_preferred();
|
||||
return file.string();
|
||||
}
|
||||
|
||||
|
@ -228,10 +228,9 @@ std::string decode_path(const char *src)
|
|||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
std::locale locale_utf8(boost::locale::generator().generate(""));
|
||||
|
||||
std::string normalize_utf8_nfc(const char *src)
|
||||
{
|
||||
static std::locale locale_utf8(boost::locale::generator().generate(""));
|
||||
return boost::locale::normalize(src, boost::locale::norm_nfc, locale_utf8);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue