From 1b2f7b6d75886325b818d46b8c6250b4d6431ccc Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 Oct 2010 17:16:09 +0000 Subject: [PATCH] Update CRT environment in wxSetEnv() for MinGW too. MinGW uses the same CRT as MSVC so we can use the same _putenv() call for it too. This ensures that wxGetenv() returns the value updated by wxSetEnv() and fixes CrtTestCase::SetGetEnv() unit test when using MinGW. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65746 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/wx/utils.h | 5 +++-- src/msw/utils.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/interface/wx/utils.h b/interface/wx/utils.h index 8bf3b1948f..c09df344ba 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -190,8 +190,9 @@ bool wxGetEnv(const wxString& var, wxString* value); environment. wxSetEnv() will always update the first copy, which means that wxGetEnv(), which uses it directly, will always return the expected value after this call. But wxSetEnv() only updates the second copy for some - compilers/CRT implementations (currently only MSVC) and so using wxGetenv() - (notice the difference in case) may not return the updated value. + compilers/CRT implementations (currently only MSVC and MinGW which uses the + same MSVC CRT) and so using wxGetenv() (notice the difference in case) may + not return the updated value. @param var The environment variable to be set, must not contain @c '=' character. diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index a456a3417a..e7445c3fcb 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -627,7 +627,7 @@ bool wxDoSetEnv(const wxString& var, const wxChar *value) // // TODO: add checks for the other compilers (and update wxSetEnv() // documentation in interface/wx/utils.h accordingly) -#if defined(__VISUALC__) +#if defined(__VISUALC__) || defined(__MINGW32__) // notice that Microsoft _putenv() has different semantics from POSIX // function with almost the same name: in particular it makes a copy of the // string instead of using it as part of environment so we can safely call -- 2.45.2