X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0207122d52499f710f144bbb306384d26f93a1eb..0b014ec713bbadb49460e4b23310fd325cdc0036:/src/mac/dir.cpp?ds=sidebyside diff --git a/src/mac/dir.cpp b/src/mac/dir.cpp index ec94a4e1ec..e37f079382 100644 --- a/src/mac/dir.cpp +++ b/src/mac/dir.cpp @@ -36,14 +36,15 @@ #include "wx/dir.h" #include "wx/filefn.h" // for wxPathExists() -#include - -#ifdef __WXMAC__ +#ifndef __WXMAC_X__ + #include +#endif -#include "morefile.h" -#include "moreextr.h" -#include "fullpath.h" -#include "fspcompa.h" +#if defined(__WXMAC__) && !defined(__UNIX__) + #include "morefile.h" + #include "moreextr.h" + #include "fullpath.h" + #include "fspcompa.h" #endif // ---------------------------------------------------------------------------- @@ -116,8 +117,12 @@ wxDirData::wxDirData(const wxString& dirname) m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ; m_CPB.hFileInfo.ioNamePtr = m_name ; m_index = 0 ; - + +#ifdef __WXMAC_X__ + // TODO: what are we supposed to do for Mac OS X +#else FSpGetDirectoryID( &fsspec , &m_dirId , &m_isDir ) ; +#endif } wxDirData::~wxDirData() @@ -131,9 +136,12 @@ void wxDirData::Rewind() bool wxDirData::Read(wxString *filename) { - if ( !m_isDir ) - return FALSE ; + if ( !m_isDir ) + return FALSE ; +#if TARGET_CARBON + char c_name[256] ; +#endif wxString result; short err = noErr ; @@ -146,7 +154,13 @@ bool wxDirData::Read(wxString *filename) err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB); if ( err != noErr ) break ; - + +#if TARGET_CARBON + p2cstrcpy( c_name, m_name ) ; + strcpy( (char *)m_name, c_name); +#else + p2cstr( m_name ) ; +#endif if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (m_flags & wxDIR_DIRS) ) // we have a directory break ; @@ -156,17 +170,37 @@ bool wxDirData::Read(wxString *filename) if ( ( m_CPB.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN) ) // its hidden but we don't want it continue ; + wxString file( m_name ) ; + if ( m_filespec.IsEmpty() || m_filespec == "*.*" ) + { + } + else if ( m_filespec.Length() > 1 && m_filespec.Left(1) =="*" ) + { + if ( file.Right( m_filespec.Length() - 1 ).Upper() != m_filespec.Mid(1).Upper() ) + { + continue ; + } + } + else if ( m_filespec.Length() > 1 && m_filespec.Right(1) == "*" ) + { + if ( file.Left( m_filespec.Length() - 1 ).Upper() != m_filespec.Left( m_filespec.Length() - 1 ).Upper() ) + { + continue ; + } + } + else if ( file.Upper() != m_filespec.Upper() ) + { + continue ; + } + break ; } if ( err != noErr ) { return FALSE ; } - FSSpec spec ; - - FSMakeFSSpecCompat(m_CPB.hFileInfo.ioVRefNum, m_dirId, m_name,&spec) ; - - *filename = wxMacFSSpec2UnixFilename( &spec ) ; + + *filename = (char*) m_name ; return TRUE; }