]> git.saurik.com Git - wxWidgets.git/commitdiff
use MoreFiles under Mac OS X
authorGilles Depeyrot <gilles_depeyrot@mac.com>
Sun, 14 Oct 2001 08:25:45 +0000 (08:25 +0000)
committerGilles Depeyrot <gilles_depeyrot@mac.com>
Sun, 14 Oct 2001 08:25:45 +0000 (08:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11985 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/dirctrlg.cpp
src/mac/carbon/dirmac.cpp
src/mac/dirmac.cpp

index da81aff51877c8b6ad5d416b97fa7fa654e2b5d3..32e05b5adf596b7be416a5b7337313f5367e55aa 100644 (file)
@@ -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) {
index 5f06ceab581703d02f5fc240854ff4d9b8c9f985..5aed922f84dbdff17f665c032c7042991b011974 100644 (file)
   #include <windows.h>
 #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;
index 5f06ceab581703d02f5fc240854ff4d9b8c9f985..5aed922f84dbdff17f665c032c7042991b011974 100644 (file)
   #include <windows.h>
 #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;