X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/92622ef4c2162596f543d304059375552db5c313..88594d02eb59a55ac85d3210a49d02918124617b:/src/mac/carbon/dirmac.cpp diff --git a/src/mac/carbon/dirmac.cpp b/src/mac/carbon/dirmac.cpp index 5f06ceab58..5aed922f84 100644 --- a/src/mac/carbon/dirmac.cpp +++ b/src/mac/carbon/dirmac.cpp @@ -40,10 +40,8 @@ #include #endif -#ifndef __DARWIN__ - #include "MoreFiles.h" - #include "MoreFilesExtras.h" -#endif +#include "MoreFiles.h" +#include "MoreFilesExtras.h" // ---------------------------------------------------------------------------- // constants @@ -76,6 +74,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 ; @@ -116,11 +116,7 @@ wxDirData::wxDirData(const wxString& dirname) m_CPB.hFileInfo.ioNamePtr = m_name ; m_index = 0 ; -#ifdef __DARWIN__ - // TODO: what are we supposed to do for Mac OS X -#else FSpGetDirectoryID( &fsspec , &m_dirId , &m_isDir ) ; -#endif } wxDirData::~wxDirData() @@ -237,6 +233,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;