X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..daebb84bff054d3833baca58a5dc506de56c64a1:/src/mac/classic/dirmac.cpp diff --git a/src/mac/classic/dirmac.cpp b/src/mac/classic/dirmac.cpp index 0afc3b5cb3..ece2dcc1cb 100644 --- a/src/mac/classic/dirmac.cpp +++ b/src/mac/classic/dirmac.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "dir.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -34,7 +30,7 @@ #endif // PCH #include "wx/dir.h" -#include "wx/filefn.h" // for wxPathExists() +#include "wx/filefn.h" // for wxDirExists() #ifndef __DARWIN__ #include @@ -77,7 +73,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 +105,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 +116,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 +147,7 @@ wxDirData::~wxDirData() { } -void wxDirData::Rewind() +void wxDirData::Rewind() { m_index = 0 ; } @@ -159,12 +155,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 +169,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 +186,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 +213,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 +233,7 @@ bool wxDirData::Read(wxString *filename) /* static */ bool wxDir::Exists(const wxString& dir) { - return wxPathExists(dir); + return wxDirExists(dir); } // ---------------------------------------------------------------------------- @@ -256,12 +252,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 +298,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 +310,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); }