return true;
}
-bool wxSetEnv(const wxString& variable, const wxChar *value)
+static bool wxDoSetEnv(const wxString& variable, const char *value)
{
wxString s = variable;
if ( value )
return putenv(buf) == 0;
}
+bool wxSetEnv(const wxString& variable, const wxString& value)
+{
+ return wxDoSetEnv(variable, value.mb_str());
+}
+
+bool wxUnsetEnv(const wxString& variable)
+{
+ return wxDoSetEnv(variable, NULL);
+}
+
+
//----------------------------------------------------------------------------
// Hostname, username, home directory
//----------------------------------------------------------------------------
#endif
// it needs to be a full path to be usable
if ( prog.compare(1, 2, _T(":\\")) == 0 )
- wxSplitPath(prog, &strDir, NULL, NULL);
+ wxFileName::SplitPath(prog, &strDir, NULL, NULL);
}
if ( strDir.empty() )
{
return strDir.c_str();
}
-wxChar *wxGetUserHome(const wxString& user)
+wxString wxGetUserHome(const wxString& user)
{
- static wxString home;
+ wxString home;
if (user.empty() || user == wxGetUserId())
- return wx_const_cast(wxChar*, wxGetHomeDir(&home));
- else
- return _T("");
+ wxGetHomeDir(&home);
+
+ return home;
}
// returns %UserName%, $USER or just "user"
if (!user)
user = _T("user");
- wxStrncpy(buf, user, n);
+ wxStrlcpy(buf, user, n);
return true;
}
if (!host)
host = _T("host");
- wxStrncpy(buf, host, n);
+ wxStrlcpy(buf, host, n);
return true;
}
argv[n] = NULL;
while (n-- > 0)
- argv[n] = wx_const_cast(wxChar*, args[n].c_str());
+ argv[n] = const_cast<wxChar*>((const char *)args[n].c_str());
long result = wxExecute(argv, flags, process);