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
This commit is contained in:
Vadim Zeitlin
2010-10-03 17:16:09 +00:00
parent 43f8864bb0
commit 1b2f7b6d75
2 changed files with 4 additions and 3 deletions

View File

@@ -190,8 +190,9 @@ bool wxGetEnv(const wxString& var, wxString* value);
environment. wxSetEnv() will always update the first copy, which means that environment. wxSetEnv() will always update the first copy, which means that
wxGetEnv(), which uses it directly, will always return the expected value wxGetEnv(), which uses it directly, will always return the expected value
after this call. But wxSetEnv() only updates the second copy for some after this call. But wxSetEnv() only updates the second copy for some
compilers/CRT implementations (currently only MSVC) and so using wxGetenv() compilers/CRT implementations (currently only MSVC and MinGW which uses the
(notice the difference in case) may not return the updated value. same MSVC CRT) and so using wxGetenv() (notice the difference in case) may
not return the updated value.
@param var @param var
The environment variable to be set, must not contain @c '=' character. The environment variable to be set, must not contain @c '=' character.

View File

@@ -627,7 +627,7 @@ bool wxDoSetEnv(const wxString& var, const wxChar *value)
// //
// TODO: add checks for the other compilers (and update wxSetEnv() // TODO: add checks for the other compilers (and update wxSetEnv()
// documentation in interface/wx/utils.h accordingly) // documentation in interface/wx/utils.h accordingly)
#if defined(__VISUALC__) #if defined(__VISUALC__) || defined(__MINGW32__)
// notice that Microsoft _putenv() has different semantics from POSIX // notice that Microsoft _putenv() has different semantics from POSIX
// function with almost the same name: in particular it makes a copy of the // 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 // string instead of using it as part of environment so we can safely call