wxSetEnv for Win32 (now seems to work)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8840 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-11-27 00:21:29 +00:00
parent 1fb454751d
commit 308978f6aa
5 changed files with 74 additions and 10 deletions

View File

@@ -292,19 +292,31 @@ static void TestDllLoad()
#include <wx/utils.h>
static wxString MyGetEnv(const wxString& var)
{
wxString val;
if ( !wxGetEnv(var, &val) )
val = _T("<empty>");
else
val = wxString(_T('\'')) + val + _T('\'');
return val;
}
static void TestEnvironment()
{
const wxChar *var = _T("wxTestVar");
puts("*** testing environment access functions ***");
printf("Initially getenv(%s) = '%s'\n", var, wxGetenv(var));
printf("Initially getenv(%s) = %s\n", var, MyGetEnv(var).c_str());
wxSetEnv(var, _T("value for wxTestVar"));
printf("After wxSetEnv: getenv(%s) = '%s'\n", var, wxGetenv(var));
printf("After wxSetEnv: getenv(%s) = %s\n", var, MyGetEnv(var).c_str());
wxSetEnv(var, _T("another value"));
printf("After 2nd wxSetEnv: getenv(%s) = '%s'\n", var, wxGetenv(var));
printf("After 2nd wxSetEnv: getenv(%s) = %s\n", var, MyGetEnv(var).c_str());
wxUnsetEnv(var);
printf("After wxUnsetEnv: getenv(%s) = '%s'\n", var, wxGetenv(var));
printf("After wxUnsetEnv: getenv(%s) = %s\n", var, MyGetEnv(var).c_str());
printf("PATH = %s\n", MyGetEnv(_T("PATH")));
}
#endif // TEST_ENVIRON