X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/97e324eff05f010ce59985c670bbe501edfa75c2..46fa338b6f7462b684b2d6c694849769f75a2cf9:/src/common/filefn.cpp diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 293e9feecf..2bb2a42402 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -751,17 +751,22 @@ wxContractPath (const wxString& filename, const wxString& envname, const wxStrin #endif // Handle User's home (ignore root homes!) - size_t len = 0; - if ((val = wxGetUserHome (user)) != NULL && - (len = wxStrlen(val)) > 2 && - wxStrncmp(dest, val, len) == 0) - { - wxStrcpy(wxFileFunctionsBuffer, wxT("~")); - if (user != wxT("")) - wxStrcat(wxFileFunctionsBuffer, (const wxChar*) user); - wxStrcat(wxFileFunctionsBuffer, dest + len); - wxStrcpy (dest, wxFileFunctionsBuffer); - } + val = wxGetUserHome (user); + if (!val) + return dest; + + const size_t len = wxStrlen(val); + if (len <= 2) + return dest; + + if (wxStrncmp(dest, val, len) == 0) + { + wxStrcpy(wxFileFunctionsBuffer, wxT("~")); + if (user != wxT("")) + wxStrcat(wxFileFunctionsBuffer, (const wxChar*) user); + wxStrcat(wxFileFunctionsBuffer, dest + len); + wxStrcpy (dest, wxFileFunctionsBuffer); + } return dest; } @@ -1304,7 +1309,8 @@ bool wxRemoveFile(const wxString& file) || defined(__BORLANDC__) \ || defined(__WATCOMC__) \ || defined(__DMC__) \ - || defined(__GNUWIN32__) + || defined(__GNUWIN32__) \ + || (defined(__MWERKS__) && defined(__MSL__)) int res = wxRemove(file); #elif defined(__WXMAC__) int res = unlink(wxFNCONV(file));