]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/dir.cpp
Copied/merged from the 2.2 branch.
[wxWidgets.git] / src / mac / dir.cpp
index f0b6664010a3bffeae63ceb7b33953e4be98c48f..e37f079382775a1b9c33eec893a53c7b5efd6290 100644 (file)
 #include "wx/dir.h"
 #include "wx/filefn.h"          // for wxPathExists()
 
-#include <windows.h>
-
-#ifdef __WXMAC__
+#ifndef __WXMAC_X__
+  #include <windows.h>
+#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,8 +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 ;