diff --git a/contrib/utils/wxrcedit/nodesdb.cpp b/contrib/utils/wxrcedit/nodesdb.cpp index df04e458ff..3612e1d334 100644 --- a/contrib/utils/wxrcedit/nodesdb.cpp +++ b/contrib/utils/wxrcedit/nodesdb.cpp @@ -49,7 +49,7 @@ void NodeInfo::Read(const wxString& filename, wxPathList& list) for (size_t i = 0; i < tf.GetLineCount(); i++) { - if (tf[i].IsEmpty() || tf[i][0u] == _T('#')) continue; + if (tf[i].empty() || tf[i][0u] == _T('#')) continue; wxStringTokenizer tkn(tf[i], _T(' ')); wxString s = tkn.GetNextToken(); if (s == _T("node")) @@ -153,7 +153,7 @@ void NodesDb::Load() void NodesDb::LoadDir(const wxString& path) { - if (!wxPathExists(path)) return; + if (!wxDirExists(path)) return; wxDir dir(path); wxString filename; diff --git a/docs/changes.txt b/docs/changes.txt index 290f75ec69..9e3ced041a 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -2,6 +2,13 @@ wxWidgets 2.5 Change Log - For more verbose changes, see the manual ------------------------------------------------------------------- +2.6 +----- + +All: + +- wxPathExists deprecated, use wxDirExists instead. + 2.5.5 ----- @@ -121,8 +128,8 @@ All: - wxGetPowerType() and wxGetBatteryState() addition - wxSystemSettings::GetSystem*() members deprecated and replaced with wxSystemSettings::Get*() -- wxWindowBase::DoGetBestSize now includes the difference (if any) between - the client size and total size of the window. Code that sets the +- wxWindowBase::DoGetBestSize now includes the difference (if any) between + the client size and total size of the window. Code that sets the client size using the best size, or that added extra space to sizers to compensate for this bug may need to be changed. - Changed calculation of scrolling area to not clip away some bits diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index 42069bf337..f9741e745b 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -190,7 +190,7 @@ the corresponding topic. \helpref{wxOnAssert}{wxonassert}\\ \helpref{wxOpenClipboard}{wxopenclipboard}\\ \helpref{wxParseCommonDialogsFilter}{wxparsecommondialogsfilter}\\ -\helpref{wxPathExists}{functionwxpathexists}\\ +\helpref{wxDirExists}{functionwxdirexists}\\ \helpref{wxPathOnly}{wxpathonly}\\ \helpref{wxPostDelete}{wxpostdelete}\\ \helpref{wxPostEvent}{wxpostevent}\\ @@ -1048,9 +1048,9 @@ Returns true if the argument is an absolute filename, i.e. with a slash or drive name at the beginning. -\membersection{::wxPathExists}\label{functionwxpathexists} +\membersection{::wxDirExists}\label{functionwxdirexists} -\func{bool}{wxPathExists}{\param{const wxString\& }{dirname}} +\func{bool}{wxDirExists}{\param{const wxString\& }{dirname}} Returns true if the path exists. diff --git a/include/wx/filefn.h b/include/wx/filefn.h index d1a8a27b65..3014c69377 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -367,7 +367,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 wxPathExists(const wxChar *pszPathName); +WXDLLIMPEXP_BASE bool wxDirExists(const wxChar *pszPathName); WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename); @@ -462,7 +462,14 @@ WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd); WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp); // compatibility defines, don't use in new code -#define wxDirExists wxPathExists +// consider removal droping 2.4 compatibility +// #if WXWIN_COMPATIBILITY_2_4 +wxDEPRECATED( inline bool wxPathExists(const wxChar *pszPathName) ); +inline bool wxPathExists(const wxChar *pszPathName) +{ + return wxDirExists(pszPathName); +} +// #endif //WXWIN_COMPATIBILITY_2_4 // ---------------------------------------------------------------------------- // separators in file names diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 2d28e3ac96..37df0c74db 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1195,7 +1195,7 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags)) } // does the path exists? (may have or not '/' or '\\' at the end) -bool wxPathExists(const wxChar *pszPathName) +bool wxDirExists(const wxChar *pszPathName) { wxString strPath(pszPathName); diff --git a/src/common/filename.cpp b/src/common/filename.cpp index c85163a67c..0e3bbb253b 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -527,7 +527,7 @@ bool wxFileName::DirExists() const bool wxFileName::DirExists( const wxString &dir ) { - return ::wxPathExists( dir ); + return ::wxDirExists( dir ); } // ---------------------------------------------------------------------------- diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index 3394172477..78501d449f 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -259,7 +259,7 @@ bool wxIsDriveAvailable(const wxString& dirName) // like it when MS-DOS app accesses empty floppy drive return (dirNameLower[0u] == wxT('a') || dirNameLower[0u] == wxT('b') || - wxPathExists(dirNameLower)); + wxDirExists(dirNameLower)); } else #endif @@ -318,7 +318,7 @@ bool wxIsDriveAvailable(const wxString& dirName) { wxString dirNameLower(dirName.Lower()); #if defined(__GNUWIN32__) && !(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) - success = wxPathExists(dirNameLower); + success = wxDirExists(dirNameLower); #else #if defined(__OS2__) // Avoid changing to drive since no media may be inserted. diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp index 124e7ae055..388d93fefd 100644 --- a/src/generic/dirdlgg.cpp +++ b/src/generic/dirdlgg.cpp @@ -216,7 +216,7 @@ void wxGenericDirDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { m_path = m_input->GetValue(); // Does the path exist? (User may have typed anything in m_input) - if (wxPathExists(m_path)) { + if (wxDirExists(m_path)) { // OK, path exists, we're done. EndModal(wxID_OK); return; @@ -320,7 +320,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) ) if (!wxEndsWithPathSeparator(path)) path += wxFILE_SEP_PATH; path += new_name; - if (wxPathExists(path)) + if (wxDirExists(path)) { // try NewName0, NewName1 etc. int i = 0; @@ -335,7 +335,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) ) path += wxFILE_SEP_PATH; path += new_name; i++; - } while (wxPathExists(path)); + } while (wxDirExists(path)); } wxLogNull log; diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 55da3ff5ff..638c1173f1 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -695,7 +695,7 @@ void wxFileCtrl::GoToHomeDir() void wxFileCtrl::GoToDir( const wxString &dir ) { - if (!wxPathExists(dir)) return; + if (!wxDirExists(dir)) return; m_dirName = dir; UpdateFiles(); @@ -1225,7 +1225,7 @@ void wxGenericFileDialog::OnSelected( wxListEvent &event ) if (!IsTopMostDir(dir)) dir += wxFILE_SEP_PATH; dir += filename; - if (wxPathExists(dir)) return; + if (wxDirExists(dir)) return; ignoreChanges = true; m_text->SetValue( filename ); @@ -1287,7 +1287,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn ) filename = dir; } - if (wxPathExists(filename)) + if (wxDirExists(filename)) { m_list->GoToDir( filename ); UpdateControls(); diff --git a/src/generic/helpext.cpp b/src/generic/helpext.cpp index 840ae94fa0..49dae623f0 100644 --- a/src/generic/helpext.cpp +++ b/src/generic/helpext.cpp @@ -259,7 +259,7 @@ bool wxExtHelpController::LoadFile(const wxString& ifile) { wxString newfile; newfile << WXEXTHELP_SEPARATOR << wxGetLocale()->GetName(); - if(wxPathExists(newfile)) + if(wxDirExists(newfile)) file = newfile; else { @@ -267,13 +267,13 @@ bool wxExtHelpController::LoadFile(const wxString& ifile) const wxChar *cptr = wxGetLocale()->GetName().c_str(); while(*cptr && *cptr != wxT('_')) newfile << *(cptr++); - if(wxPathExists(newfile)) + if(wxDirExists(newfile)) file = newfile; } } #endif - if(! wxPathExists(file)) + if(! wxDirExists(file)) return false; mapFile << file << WXEXTHELP_SEPARATOR << WXEXTHELP_MAPFILE; diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 71d76a6915..61925cde04 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -195,7 +195,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, if ( style & wxSAVE ) { - if ( !defaultDir.IsEmpty() ) + if ( !defaultDir.empty() ) gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(defaultDir)); @@ -204,10 +204,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, } else { - if ( !defaultFileName.IsEmpty() ) + if ( !defaultFileName.empty() ) { wxString dir; - if ( defaultDir.IsEmpty() ) + if ( defaultDir.empty() ) dir = ::wxGetCwd(); else dir = defaultDir; @@ -216,7 +216,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB( wxFileName(dir, defaultFileName).GetFullPath() ) ); } - else if ( !defaultDir.IsEmpty() ) + else if ( !defaultDir.empty() ) gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(defaultDir) ); } @@ -354,7 +354,7 @@ void wxFileDialog::SetDirectory(const wxString& dir) #ifdef __WXGTK24__ if (!gtk_check_version(2,4,0)) { - if (wxPathExists(dir)) + if (wxDirExists(dir)) { gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir)); } diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 71d76a6915..61925cde04 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -195,7 +195,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, if ( style & wxSAVE ) { - if ( !defaultDir.IsEmpty() ) + if ( !defaultDir.empty() ) gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(defaultDir)); @@ -204,10 +204,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, } else { - if ( !defaultFileName.IsEmpty() ) + if ( !defaultFileName.empty() ) { wxString dir; - if ( defaultDir.IsEmpty() ) + if ( defaultDir.empty() ) dir = ::wxGetCwd(); else dir = defaultDir; @@ -216,7 +216,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB( wxFileName(dir, defaultFileName).GetFullPath() ) ); } - else if ( !defaultDir.IsEmpty() ) + else if ( !defaultDir.empty() ) gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(defaultDir) ); } @@ -354,7 +354,7 @@ void wxFileDialog::SetDirectory(const wxString& dir) #ifdef __WXGTK24__ if (!gtk_check_version(2,4,0)) { - if (wxPathExists(dir)) + if (wxDirExists(dir)) { gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir)); } diff --git a/src/mac/carbon/dirmac.cpp b/src/mac/carbon/dirmac.cpp index e9df6eedac..7c3651fd63 100644 --- a/src/mac/carbon/dirmac.cpp +++ b/src/mac/carbon/dirmac.cpp @@ -34,7 +34,7 @@ #endif // PCH #include "wx/dir.h" -#include "wx/filefn.h" // for wxPathExists() +#include "wx/filefn.h" // for wxDirExists() #ifndef __DARWIN__ #include @@ -69,12 +69,12 @@ class wxDirData public: wxDirData(const wxString& dirname); ~wxDirData(); - + void Close() ; void SetFileSpec(const wxString& filespec) { m_filespec = filespec; } void SetFlags(int flags) { m_flags = flags; } - bool Read(wxString *filename); // reads the next + bool Read(wxString *filename); // reads the next void Rewind() ; const wxString& GetName() const { return m_dirname; } @@ -116,7 +116,7 @@ wxDirData::~wxDirData() } void wxDirData::Close() -{ +{ if ( m_iterator ) { FSCloseIterator( m_iterator ) ; @@ -124,13 +124,13 @@ void wxDirData::Close() } } -void wxDirData::Rewind() +void wxDirData::Rewind() { Close() ; } bool wxDirData::Read(wxString *filename) -{ +{ wxString result; OSStatus err = noErr ; if ( NULL == m_iterator ) @@ -139,17 +139,17 @@ bool wxDirData::Read(wxString *filename) err = wxMacPathToFSRef( m_dirname , &dirRef ) ; if ( err == noErr ) { - err = FSOpenIterator(&dirRef, kFSIterateFlat, &m_iterator); - } - if ( err ) - { - Close() ; - return FALSE ; - } + err = FSOpenIterator(&dirRef, kFSIterateFlat, &m_iterator); + } + if ( err ) + { + Close() ; + return false ; + } } - + wxString name ; - + while( noErr == err ) { HFSUniStr255 uniname ; @@ -160,12 +160,12 @@ bool wxDirData::Read(wxString *filename) err = FSGetCatalogInfoBulk( m_iterator, 1, &fetched, NULL, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo , &catalogInfo , &fileRef, NULL, &uniname ); if ( errFSNoMoreItems == err ) return false ; - + wxASSERT( noErr == err ) ; - + if ( noErr != err ) break ; - + name = wxMacHFSUniStrToString( &uniname ) ; if ( ( name == wxT(".") || name == wxT("..") ) && !(m_flags & wxDIR_DOTDOT) ) @@ -176,7 +176,7 @@ bool wxDirData::Read(wxString *filename) if ( (((FileInfo*)&catalogInfo.finderInfo)->finderFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN ) ) continue ; - + // its a dir and we don't want it if ( (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) && !(m_flags & wxDIR_DIRS) ) continue ; @@ -184,24 +184,24 @@ bool wxDirData::Read(wxString *filename) // its a file but we don't want it if ( (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) == 0 && !(m_flags & wxDIR_FILES ) ) continue ; - - if ( m_filespec.IsEmpty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") ) + + if ( m_filespec.empty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") ) { } - else if ( !wxMatchWild(m_filespec, name , FALSE) ) + else if ( !wxMatchWild(m_filespec, name , false) ) { continue ; } - + break ; } if ( err != noErr ) { - return FALSE ; + return false ; } - + *filename = name ; - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -211,7 +211,7 @@ bool wxDirData::Read(wxString *filename) /* static */ bool wxDir::Exists(const wxString& dir) { - return wxPathExists(dir); + return wxDirExists(dir); } // ---------------------------------------------------------------------------- @@ -230,7 +230,7 @@ bool wxDir::Open(const wxString& dirname) delete M_DIR; m_data = new wxDirData(dirname); - return TRUE; + return true; } bool wxDir::IsOpened() const @@ -270,7 +270,7 @@ bool wxDir::GetFirst(wxString *filename, const wxString& filespec, int flags) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); M_DIR->Rewind(); @@ -282,9 +282,9 @@ bool wxDir::GetFirst(wxString *filename, bool wxDir::GetNext(wxString *filename) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); - wxCHECK_MSG( filename, FALSE, _T("bad pointer in wxDir::GetNext()") ); + wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") ); return M_DIR->Read(filename); } diff --git a/src/mac/classic/dirmac.cpp b/src/mac/classic/dirmac.cpp index 0afc3b5cb3..10587442a0 100644 --- a/src/mac/classic/dirmac.cpp +++ b/src/mac/classic/dirmac.cpp @@ -34,7 +34,7 @@ #endif // PCH #include "wx/dir.h" -#include "wx/filefn.h" // for wxPathExists() +#include "wx/filefn.h" // for wxDirExists() #ifndef __DARWIN__ #include @@ -77,7 +77,7 @@ public: void SetFileSpec(const wxString& filespec) { m_filespec = filespec; } void SetFlags(int flags) { m_flags = flags; } - bool Read(wxString *filename); // reads the next + bool Read(wxString *filename); // reads the next void Rewind() ; const wxString& GetName() const { return m_dirname; } @@ -109,9 +109,9 @@ wxDirData::wxDirData(const wxString& dirname) : m_dirname(dirname) { m_ok = false; - + OSErr err; - + // throw away the trailing slashes size_t n = m_dirname.length(); wxCHECK_RET( n, _T("empty dir name in wxDir") ); @@ -120,14 +120,14 @@ wxDirData::wxDirData(const wxString& dirname) ; m_dirname.Truncate(n + 1); - + #ifdef __DARWIN__ FSRef theRef; // get the FSRef associated with the POSIX path err = FSPathMakeRef((const UInt8 *) m_dirname.c_str(), &theRef, NULL); FSGetVRefNum(&theRef, &(m_CPB.hFileInfo.ioVRefNum)); - + err = FSGetNodeID( &theRef , &m_dirId , &m_isDir ) ; #else FSSpec fsspec ; @@ -151,7 +151,7 @@ wxDirData::~wxDirData() { } -void wxDirData::Rewind() +void wxDirData::Rewind() { m_index = 0 ; } @@ -159,12 +159,12 @@ void wxDirData::Rewind() bool wxDirData::Read(wxString *filename) { if ( !m_isDir ) - return FALSE ; - + return false ; + wxString result; short err = noErr ; - + while ( err == noErr ) { m_index++ ; @@ -173,7 +173,7 @@ bool wxDirData::Read(wxString *filename) err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB); if ( err != noErr ) break ; - + // its hidden but we don't want it if ( ( m_CPB.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN) ) continue ; @@ -190,13 +190,13 @@ bool wxDirData::Read(wxString *filename) // we have a directory if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (m_flags & wxDIR_DIRS) ) break ; - + // its a file but we don't want it if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) == 0 && !(m_flags & wxDIR_FILES ) ) continue ; - + wxString file = wxMacMakeStringFromPascal( m_name ) ; - if ( m_filespec.IsEmpty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") ) + if ( m_filespec.empty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") ) { } else if ( m_filespec.Length() > 1 && m_filespec.Left(1) == wxT("*") ) @@ -217,17 +217,17 @@ bool wxDirData::Read(wxString *filename) { continue ; } - + break ; } if ( err != noErr ) { - return FALSE ; + return false ; } - + *filename = wxMacMakeStringFromPascal( m_name ) ; - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -237,7 +237,7 @@ bool wxDirData::Read(wxString *filename) /* static */ bool wxDir::Exists(const wxString& dir) { - return wxPathExists(dir); + return wxDirExists(dir); } // ---------------------------------------------------------------------------- @@ -256,12 +256,12 @@ bool wxDir::Open(const wxString& dirname) delete M_DIR; m_data = new wxDirData(dirname); if (m_data->Ok()) - return TRUE; + return true; else { delete m_data; m_data = NULL; - return FALSE; + return false; } } @@ -302,7 +302,7 @@ bool wxDir::GetFirst(wxString *filename, const wxString& filespec, int flags) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); M_DIR->Rewind(); @@ -314,9 +314,9 @@ bool wxDir::GetFirst(wxString *filename, bool wxDir::GetNext(wxString *filename) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); - wxCHECK_MSG( filename, FALSE, _T("bad pointer in wxDir::GetNext()") ); + wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") ); return M_DIR->Read(filename); } diff --git a/src/mgl/dirmgl.cpp b/src/mgl/dirmgl.cpp index e7c59d21b4..b07cd56dc7 100644 --- a/src/mgl/dirmgl.cpp +++ b/src/mgl/dirmgl.cpp @@ -109,7 +109,7 @@ wxDirData::~wxDirData() void wxDirData::SetFileSpec(const wxString& filespec) { #ifdef __DOS__ - if ( filespec.IsEmpty() ) + if ( filespec.empty() ) m_filespec = _T("*.*"); else #endif @@ -128,10 +128,10 @@ void wxDirData::Rewind() bool wxDirData::Read(wxString *filename) { PM_findData data; - bool matches = FALSE; + bool matches = false; data.dwSize = sizeof(data); - + wxString path = m_dirname; path += wxFILE_SEP_PATH; path.reserve(path.length() + 255); // speed up string concatenation @@ -141,7 +141,7 @@ bool wxDirData::Read(wxString *filename) if ( m_dir ) { if ( !PM_findNextFile(m_dir, &data) ) - return FALSE; + return false; } else { @@ -149,7 +149,7 @@ bool wxDirData::Read(wxString *filename) if ( m_dir == PM_FILE_INVALID ) { m_dir = NULL; - return FALSE; + return false; } } @@ -177,12 +177,12 @@ bool wxDirData::Read(wxString *filename) continue; } - matches = m_flags & wxDIR_HIDDEN ? TRUE : !(data.attrib & PM_FILE_HIDDEN); + matches = m_flags & wxDIR_HIDDEN ? true : !(data.attrib & PM_FILE_HIDDEN); } *filename = data.name; - return TRUE; + return true; } @@ -193,7 +193,7 @@ bool wxDirData::Read(wxString *filename) /* static */ bool wxDir::Exists(const wxString& dir) { - return wxPathExists(dir); + return wxDirExists(dir); } // ---------------------------------------------------------------------------- @@ -211,15 +211,15 @@ bool wxDir::Open(const wxString& dirname) { delete M_DIR; m_data = NULL; - + if ( !wxDir::Exists(dirname) ) { wxLogError(_("Directory '%s' doesn't exist!"), dirname.c_str()); - return FALSE; + return false; } - + m_data = new wxDirData(dirname); - return TRUE; + return true; } bool wxDir::IsOpened() const @@ -256,7 +256,7 @@ bool wxDir::GetFirst(wxString *filename, const wxString& filespec, int flags) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); M_DIR->Rewind(); @@ -268,9 +268,9 @@ bool wxDir::GetFirst(wxString *filename, bool wxDir::GetNext(wxString *filename) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); - wxCHECK_MSG( filename, FALSE, _T("bad pointer in wxDir::GetNext()") ); + wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") ); return M_DIR->Read(filename); } diff --git a/src/msw/dir.cpp b/src/msw/dir.cpp index 4240cd0930..d13cf27c0b 100644 --- a/src/msw/dir.cpp +++ b/src/msw/dir.cpp @@ -34,7 +34,7 @@ #endif // PCH #include "wx/dir.h" -#include "wx/filefn.h" // for wxPathExists() +#include "wx/filefn.h" // for wxDirExists() #ifdef __WXMSW__ #include "wx/msw/private.h" @@ -287,7 +287,7 @@ bool wxDirData::Read(wxString *filename) /* static */ bool wxDir::Exists(const wxString& dir) { - return wxPathExists(dir); + return wxDirExists(dir); } // ---------------------------------------------------------------------------- diff --git a/src/msw/mslu.cpp b/src/msw/mslu.cpp index c830ecf70e..f6f373a965 100644 --- a/src/msw/mslu.cpp +++ b/src/msw/mslu.cpp @@ -119,7 +119,7 @@ static void wxFixOPENFILENAME(LPOPENFILENAME ofn) if ( (ofn->Flags & OFN_ALLOWMULTISELECT) && ofn->lpstrFile[ofn->nFileOffset-1] != wxT('\0') ) { - if ( wxPathExists(ofn->lpstrFile) ) + if ( wxDirExists(ofn->lpstrFile) ) { // 1st component is dir => multiple files selected ofn->nFileOffset = wxStrlen(ofn->lpstrFile)+1; diff --git a/src/os2/dir.cpp b/src/os2/dir.cpp index 9bb2087162..ab35717cbf 100644 --- a/src/os2/dir.cpp +++ b/src/os2/dir.cpp @@ -81,7 +81,7 @@ static inline FIND_DATA FindFirst( rc = ::DosFindFirst( rsSpec.c_str() ,&hDir - ,0x37 // was: FILE_NORMAL + ,0x37 // was: FILE_NORMAL ,pFinddata ,sizeof(FILEFINDBUF3) ,&ulFindCount @@ -213,7 +213,7 @@ bool wxDirData::Read( wxString* psFilename ) { - bool bFirst = FALSE; + bool bFirst = false; FILEFINDBUF3 vFinddata; #define PTR_TO_FINDDATA (&vFinddata) @@ -234,12 +234,12 @@ bool wxDirData::Read( m_vFinddata = FindFirst( sFilespec ,PTR_TO_FINDDATA ); - bFirst = TRUE; + bFirst = true; } if ( !IsFindDataOk(m_vFinddata) ) { - return FALSE; + return false; } const wxChar* zName; @@ -249,7 +249,7 @@ bool wxDirData::Read( { if (bFirst) { - bFirst = FALSE; + bFirst = false; } else { @@ -257,7 +257,7 @@ bool wxDirData::Read( ,PTR_TO_FINDDATA )) { - return FALSE; + return false; } } @@ -309,7 +309,7 @@ bool wxDirData::Read( *psFilename = zName; break; } - return TRUE; + return true; } // end of wxDirData::Read // ---------------------------------------------------------------------------- @@ -321,7 +321,7 @@ bool wxDir::Exists( const wxString& rsDir ) { - return wxPathExists(rsDir); + return wxDirExists(rsDir); } // end of wxDir::Exists // ---------------------------------------------------------------------------- @@ -343,7 +343,7 @@ bool wxDir::Open( { delete M_DIR; m_data = new wxDirData(rsDirname); - return TRUE; + return true; } // end of wxDir::Open bool wxDir::IsOpened() const @@ -388,7 +388,7 @@ bool wxDir::GetFirst( , int nFlags ) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); M_DIR->Rewind(); M_DIR->SetFileSpec(rsFilespec); M_DIR->SetFlags(nFlags); @@ -399,8 +399,8 @@ bool wxDir::GetNext( wxString* psFilename ) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); - wxCHECK_MSG( psFilename, FALSE, _T("bad pointer in wxDir::GetNext()") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); + wxCHECK_MSG( psFilename, false, _T("bad pointer in wxDir::GetNext()") ); return M_DIR->Read(psFilename); } // end of wxDir::GetNext diff --git a/src/os2/wx25.def b/src/os2/wx25.def index c2615d9b06..f073efc3c9 100644 --- a/src/os2/wx25.def +++ b/src/os2/wx25.def @@ -2299,8 +2299,8 @@ EXPORTS wxStripExtension__FPc ;wxPathOnly(const wxString&) wxPathOnly__FRC8wxString - ;wxPathExists(const char*) - wxPathExists__FPCc + ;wxDirExists(const char*) + wxDirExists__FPCc ;wxPathList::FindValidPath(const wxString&) FindValidPath__10wxPathListFRC8wxString ;wxPathList::FindAbsoluteValidPath(const wxString&) @@ -13919,8 +13919,8 @@ EXPORTS wxDrawBorder__FUlR6_RECTLT1 ;wxShutdown(wxShutdownFlags) wxShutdown__F15wxShutdownFlags - ;wxPathExists(const wxString&) - wxPathExists__FRC8wxString + ;wxDirExists(const wxString&) + wxDirExists__FRC8wxString ;wxGetWindowText(unsigned long) wxGetWindowText__FUl ;wxGetWindowId(unsigned long) diff --git a/src/palmos/dir.cpp b/src/palmos/dir.cpp index 715d387747..7ae2827cfd 100644 --- a/src/palmos/dir.cpp +++ b/src/palmos/dir.cpp @@ -34,7 +34,7 @@ #endif // PCH #include "wx/dir.h" -#include "wx/filefn.h" // for wxPathExists() +#include "wx/filefn.h" // for wxDirExists() // ---------------------------------------------------------------------------- // define the types and functions used for file searching diff --git a/src/unix/dir.cpp b/src/unix/dir.cpp index 0aeffa42b8..6907ca9b4a 100644 --- a/src/unix/dir.cpp +++ b/src/unix/dir.cpp @@ -120,26 +120,26 @@ wxDirData::~wxDirData() bool wxDirData::Read(wxString *filename) { dirent *de = (dirent *)NULL; // just to silence compiler warnings - bool matches = FALSE; + bool matches = false; // speed up string concatenation in the loop a bit wxString path = m_dirname; path += _T('/'); path.reserve(path.length() + 255); - + wxString de_d_name; while ( !matches ) { de = readdir(m_dir); if ( !de ) - return FALSE; - + return false; + #if wxUSE_UNICODE de_d_name = wxConvFileName->cMB2WC( de->d_name ); #else de_d_name = de->d_name; -#endif +#endif // don't return "." and ".." unless asked for if ( de->d_name[0] == '.' && @@ -168,7 +168,7 @@ bool wxDirData::Read(wxString *filename) // finally, check the name if ( m_filespec.empty() ) { - matches = m_flags & wxDIR_HIDDEN ? TRUE : de->d_name[0] != '.'; + matches = m_flags & wxDIR_HIDDEN ? true : de->d_name[0] != '.'; } else { @@ -180,7 +180,7 @@ bool wxDirData::Read(wxString *filename) *filename = de_d_name; - return TRUE; + return true; } #else // old VMS (TODO) @@ -196,7 +196,7 @@ wxDirData::~wxDirData() bool wxDirData::Read(wxString * WXUNUSED(filename)) { - return FALSE; + return false; } #endif // not or new VMS/old VMS @@ -208,7 +208,7 @@ bool wxDirData::Read(wxString * WXUNUSED(filename)) /* static */ bool wxDir::Exists(const wxString& dir) { - return wxPathExists(dir); + return wxDirExists(dir); } // ---------------------------------------------------------------------------- @@ -235,10 +235,10 @@ bool wxDir::Open(const wxString& dirname) delete M_DIR; m_data = NULL; - return FALSE; + return false; } - return TRUE; + return true; } bool wxDir::IsOpened() const @@ -275,7 +275,7 @@ bool wxDir::GetFirst(wxString *filename, const wxString& filespec, int flags) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); M_DIR->Rewind(); @@ -287,16 +287,16 @@ bool wxDir::GetFirst(wxString *filename, bool wxDir::GetNext(wxString *filename) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); - wxCHECK_MSG( filename, FALSE, _T("bad pointer in wxDir::GetNext()") ); + wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") ); return M_DIR->Read(filename); } bool wxDir::HasSubDirs(const wxString& spec) { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); if ( spec.empty() ) { @@ -317,7 +317,7 @@ bool wxDir::HasSubDirs(const wxString& spec) { case 2: // just "." and ".." - return FALSE; + return false; case 0: case 1: @@ -329,7 +329,7 @@ bool wxDir::HasSubDirs(const wxString& spec) // assume we have subdirs - may turn out to be wrong if we // have other hard links to this directory but it's not // that bad as explained above - return TRUE; + return true; } } } diff --git a/tests/archive/archivetest.cpp b/tests/archive/archivetest.cpp index dd04edd3aa..1e09053104 100644 --- a/tests/archive/archivetest.cpp +++ b/tests/archive/archivetest.cpp @@ -912,7 +912,7 @@ void ArchiveTestCase::VerifyDir(wxString& path, name = m_factory->GetInternalName( path.substr(rootlen, wxString::npos)); - bool isDir = wxPathExists(path); + bool isDir = wxDirExists(path); if (isDir) name += _T("/");