diff system/System.cpp @ 1477:b60cb1637634 plugin-path-config

Setenv is nicer here
author Chris Cannam
date Thu, 07 Jun 2018 16:39:58 +0100
parents bd1a2cacd1e7
children 5ac102155409
line wrap: on
line diff
--- a/system/System.cpp	Thu Jun 07 16:18:42 2018 +0100
+++ b/system/System.cpp	Thu Jun 07 16:39:58 2018 +0100
@@ -394,9 +394,9 @@
 bool
 putEnvUtf8(std::string variable, std::string value)
 {
+#ifdef _WIN32
     std::string entry = variable + "=" + value;
     
-#ifdef _WIN32
     int wentlen = MultiByteToWideChar(CP_UTF8, 0,
                                       entry.c_str(), int(entry.length()),
                                       0, 0);
@@ -424,8 +424,7 @@
 
 #else
 
-    int rv = putenv(entry.c_str());
-
+    int rv = setenv(variable.c_str(), value.c_str(), 1);
     if (rv != 0) {
         SVCERR << "WARNING: Failed to set environment entry" << endl;
         return false;