X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5fde6fcc9b551340a194ae4c726db5ab64b5c594..4ccae30a4dcdd995b3b566f8901a42509774d3d8:/src/mac/carbon/dirmac.cpp diff --git a/src/mac/carbon/dirmac.cpp b/src/mac/carbon/dirmac.cpp index e37f079382..1acff5b7ca 100644 --- a/src/mac/carbon/dirmac.cpp +++ b/src/mac/carbon/dirmac.cpp @@ -36,16 +36,14 @@ #include "wx/dir.h" #include "wx/filefn.h" // for wxPathExists() -#ifndef __WXMAC_X__ +#ifndef __DARWIN__ #include #endif -#if defined(__WXMAC__) && !defined(__UNIX__) - #include "morefile.h" - #include "moreextr.h" - #include "fullpath.h" - #include "fspcompa.h" -#endif +#include "wx/mac/private.h" + +#include "MoreFiles.h" +#include "MoreFilesExtras.h" // ---------------------------------------------------------------------------- // constants @@ -78,6 +76,8 @@ public: bool Read(wxString *filename); // reads the next void Rewind() ; + const wxString& GetName() const { return m_dirname; } + private: CInfoPBRec m_CPB ; wxInt16 m_index ; @@ -113,16 +113,12 @@ wxDirData::wxDirData(const wxString& dirname) FSSpec fsspec ; - wxUnixFilename2FSSpec( m_dirname , &fsspec ) ; + wxMacFilename2FSSpec( m_dirname , &fsspec ) ; 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() @@ -171,7 +167,7 @@ bool wxDirData::Read(wxString *filename) continue ; wxString file( m_name ) ; - if ( m_filespec.IsEmpty() || m_filespec == "*.*" ) + if ( m_filespec.IsEmpty() || m_filespec == "*.*" || m_filespec == "*" ) { } else if ( m_filespec.Length() > 1 && m_filespec.Left(1) =="*" ) @@ -239,6 +235,22 @@ bool wxDir::IsOpened() const return m_data != NULL; } +wxString wxDir::GetName() const +{ + wxString name; + if ( m_data ) + { + name = M_DIR->GetName(); + if ( !name.empty() && (name.Last() == _T('/')) ) + { + // chop off the last (back)slash + name.Truncate(name.length() - 1); + } + } + + return name; +} + wxDir::~wxDir() { delete M_DIR;