static bool wxDoSetEnv(const wxString& variable, const char *value)
{
#if defined(HAVE_SETENV)
+ if ( !value )
+ {
+#ifdef HAVE_UNSETENV
+ // don't test unsetenv() return value: it's void on some systems (at
+ // least Darwin)
+ unsetenv(variable.mb_str());
+ return true;
+#else
+ value = ""; // we can't pass NULL to setenv()
+#endif
+ }
+
return setenv(variable.mb_str(), value, 1 /* overwrite */) == 0;
#elif defined(HAVE_PUTENV)
wxString s = variable;