X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bade0251e3ca060eb17bc5880263a17842e6ad00..63e02796620637b50a96d74a2264f3dea8def866:/src/common/filefn.cpp diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 2bd1b05de3..1a25881ada 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1270,7 +1270,7 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags)) #elif defined(__OS2__) return (::DosDeleteDir((PSZ)dir.c_str()) == 0); #elif defined(__WXWINCE__) - return (CreateDirectory(dir, NULL) != 0); + return (RemoveDirectory(dir) != 0); #elif defined(__WXPALMOS__) // TODO with VFSFileRename() return false; @@ -1280,9 +1280,9 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags)) } // does the path exists? (may have or not '/' or '\\' at the end) -bool wxDirExists(const wxChar *pszPathName) +bool wxDirExists(const wxString& pathName) { - wxString strPath(pszPathName); + wxString strPath(pathName); #if defined(__WINDOWS__) || defined(__OS2__) // Windows fails to find directory named "c:\dir\" even if "c:\dir" exists, @@ -1326,7 +1326,7 @@ bool wxDirExists(const wxChar *pszPathName) return wxStat(strPath.c_str(), &st) == 0 && ((st.st_mode & S_IFMT) == S_IFDIR); #else // S_IFMT not supported in VA compilers.. st_mode is a 2byte value only - return wxStat(pszPathName, &st) == 0 && (st.st_mode == S_IFDIR); + return wxStat(strPath.c_str(), &st) == 0 && (st.st_mode == S_IFDIR); #endif #endif // __WIN32__/!__WIN32__ @@ -1575,6 +1575,14 @@ wxString wxGetCwd() bool wxSetWorkingDirectory(const wxString& d) { #if defined(__OS2__) + if (d[1] == ':') + { + ::DosSetDefaultDisk(1 + wxToupper(d[0]) - _T('A')); + // do not call DosSetCurrentDir when just changing drive, + // since it requires e.g. "d:." instead of "d:"! + if (d.length() == 2) + return true; + } return (::DosSetCurrentDir((PSZ)d.c_str()) == 0); #elif defined(__UNIX__) || defined(__WXMAC__) || defined(__DOS__) return (chdir(wxFNSTRINGCAST d.fn_str()) == 0);