From e960c20e389061c0db09e03fdaf9ffe3a418779b Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 2 Mar 2007 12:44:52 +0000 Subject: [PATCH 1/1] changes wxDirExists() to accept wxString instead of wxChar*, so that it can be used with any string literals git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44596 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/function.tex | 2 +- include/wx/filefn.h | 2 +- src/common/filefn.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index 5882a03c7f..f4d92c2998 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -1114,7 +1114,7 @@ or drive name at the beginning. \membersection{::wxDirExists}\label{functionwxdirexists} -\func{bool}{wxDirExists}{\param{const wxChar *}{dirname}} +\func{bool}{wxDirExists}{\param{const wxString\& }{dirname}} Returns true if \arg{dirname} exists and is a directory. diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 10c420b1cb..466adfaa7d 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -452,7 +452,7 @@ const int wxInvalidOffset = -1; WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename); // does the path exist? (may have or not '/' or '\\' at the end) -WXDLLIMPEXP_BASE bool wxDirExists(const wxChar *pszPathName); +WXDLLIMPEXP_BASE bool wxDirExists(const wxString& pathName); WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename); diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 1f87e838c5..1a25881ada 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -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__ -- 2.45.2