From: Gilles Depeyrot Date: Sun, 14 Oct 2001 08:25:45 +0000 (+0000) Subject: use MoreFiles under Mac OS X X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f4ac0693010cf3974ecf82d811829d13797805fb use MoreFiles under Mac OS X git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11985 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index da81aff518..32e05b5adf 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -68,8 +68,8 @@ #endif // __WXPM__ -#if defined(__WXMAC__) && !defined(__UNIX__) -#include "moreextr.h" +#if defined(__WXMAC__) +# include "MoreFilesExtras.h" #endif #ifdef __BORLANDC__ @@ -598,7 +598,7 @@ void wxGenericDirCtrl::SetupSections() } } #endif -#elif defined(__WXMAC__) && !defined(__UNIX__) +#elif defined(__WXMAC__) FSSpec volume ; short index = 1 ; while(1) { 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; diff --git a/src/mac/dirmac.cpp b/src/mac/dirmac.cpp index 5f06ceab58..5aed922f84 100644 --- a/src/mac/dirmac.cpp +++ b/src/mac/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;