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

@@ -457,6 +457,29 @@ bool wxDirExists(const wxString& dir)
#endif // Win32/16
}
// ----------------------------------------------------------------------------
// env vars
// ----------------------------------------------------------------------------
bool wxGetEnv(const wxString& var, wxString *value)
{
// first get the size of the buffer
DWORD dwRet = ::GetEnvironmentVariable(var, NULL, 0);
if ( !dwRet )
{
// this means that there is no such variable
return FALSE;
}
if ( value )
{
(void)::GetEnvironmentVariable(var, value->GetWriteBuf(dwRet), dwRet);
value->UngetWriteBuf();
}
return TRUE;
}
bool wxSetEnv(const wxString& var, const wxChar *value)
{
// some compilers have putenv() or _putenv() or _wputenv() but it's better