X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/73dd8b2deb90b586852e97682082c353d2d03606..9534d0dfdc3c6fad8ea5d5fd31bbb6f20650929b:/src/msdos/utilsdos.cpp diff --git a/src/msdos/utilsdos.cpp b/src/msdos/utilsdos.cpp index 799a3fc5e7..ff4647668c 100644 --- a/src/msdos/utilsdos.cpp +++ b/src/msdos/utilsdos.cpp @@ -96,7 +96,7 @@ bool wxGetEnv(const wxString& var, wxString *value) return true; } -bool wxSetEnv(const wxString& variable, const wxChar *value) +static bool wxDoSetEnv(const wxString& variable, const char *value) { wxString s = variable; if ( value ) @@ -112,6 +112,17 @@ bool wxSetEnv(const wxString& variable, const wxChar *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 //---------------------------------------------------------------------------- @@ -200,14 +211,14 @@ const wxChar* wxGetHomeDir(wxString *home) 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" @@ -310,7 +321,7 @@ long wxExecute(const wxString& command, int flags, wxProcess *process) argv[n] = NULL; while (n-- > 0) - argv[n] = wx_const_cast(wxChar*, args[n].c_str()); + argv[n] = wx_const_cast(wxChar*, (const char *)args[n].c_str()); long result = wxExecute(argv, flags, process); @@ -329,7 +340,7 @@ public: : wxFFileInputStream(name, _T("rt")) { } - ~wxTempFileInStream() + virtual ~wxTempFileInStream() { m_file->Close(); wxRemoveFile(m_file->GetName());