From ad5fcce6e4fd172cb105a71b9ef658338d742f56 Mon Sep 17 00:00:00 2001 From: fredizzimo Date: Sun, 7 Jan 2018 23:20:02 +0200 Subject: [PATCH] Fix environment variable setting on Windows (#674) The previous way of checking that _putenv_s is defined does not work, because _putenv_s is a function and not a define. This is a partial application of commit 31115e0369747b1e1c45cbe3f2a90f6dff66666a from alexrj/Slic3r. I tried cherry picking the whole commit, but unicode is already handled diffrently here, so that would have been a lot of work. --- xs/src/libslic3r/Config.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/xs/src/libslic3r/Config.cpp b/xs/src/libslic3r/Config.cpp index 728ed608b8..474be72372 100644 --- a/xs/src/libslic3r/Config.cpp +++ b/xs/src/libslic3r/Config.cpp @@ -18,10 +18,6 @@ #include #include -#if defined(_WIN32) && !defined(setenv) && defined(_putenv_s) -#define setenv(k, v, o) _putenv_s(k, v) -#endif - namespace Slic3r { std::string escape_string_cstyle(const std::string &str) @@ -309,7 +305,6 @@ double ConfigBase::get_abs_value(const t_config_option_key &opt_key, double rati void ConfigBase::setenv_() { -#ifdef setenv t_config_option_keys opt_keys = this->keys(); for (t_config_option_keys::const_iterator it = opt_keys.begin(); it != opt_keys.end(); ++it) { // prepend the SLIC3R_ prefix @@ -322,9 +317,8 @@ void ConfigBase::setenv_() for (size_t i = 0; i < envname.size(); ++i) envname[i] = (envname[i] <= 'z' && envname[i] >= 'a') ? envname[i]-('a'-'A') : envname[i]; - setenv(envname.c_str(), this->serialize(*it).c_str(), 1); + boost::nowide::setenv(envname.c_str(), this->serialize(*it).c_str(), 1); } -#endif } void ConfigBase::load(const std::string &file)