forked from bartvdbraak/blender
use SetEnvironmentVariableA to set env var on windows
This commit is contained in:
parent
981f7fcd0d
commit
d31d7fd487
@ -565,6 +565,8 @@ elseif(WIN32)
|
||||
set(ICONV_INCLUDE_DIRS ${ICONV}/include)
|
||||
set(ICONV_LIBRARIES iconv)
|
||||
set(ICONV_LIBPATH ${ICONV}/lib)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MD")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MD")
|
||||
endif()
|
||||
|
||||
if(WITH_SAMPLERATE)
|
||||
|
@ -72,6 +72,7 @@
|
||||
#endif
|
||||
#define _WIN32_IE 0x0501
|
||||
#include <windows.h>
|
||||
#include <Winbase.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
#include "BLI_winstuff.h"
|
||||
@ -1157,14 +1158,13 @@ void BLI_setenv(const char *env, const char*val)
|
||||
{
|
||||
/* SGI or free windows */
|
||||
#if (defined(__sgi) || ((defined(WIN32) || defined(WIN64)) && defined(FREE_WINDOWS)))
|
||||
char *envstr= MEM_mallocN(sizeof(char) * (strlen(env) + strlen(val) + 2), "envstr"); /* one for = another for \0 */
|
||||
|
||||
sprintf(envstr, "%s=%s", env, val);
|
||||
char *envstr= BLI_sprintfN("%s=%s", env, val);
|
||||
putenv(envstr);
|
||||
MEM_freeN(envstr);
|
||||
|
||||
/* non-free windows */
|
||||
#elif (defined(WIN32) || defined(WIN64)) /* not free windows */
|
||||
SetEnvironmentVariableA(env, val);
|
||||
_putenv_s(env, val);
|
||||
#else
|
||||
/* linux/osx/bsd */
|
||||
|
Loading…
Reference in New Issue
Block a user