/////////////////////////////////////////////////////////////////////////////
-// Name: msw/dir.cpp
+// Name: mac/dirmac.cpp
// Purpose: wxDir implementation for Mac
// Author: Stefan Csomor
// Modified by:
#pragma hdrstop
#endif
+#include "wx/dir.h"
+
#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/log.h"
#endif // PCH
-#include "wx/dir.h"
#include "wx/filefn.h" // for wxDirExists()
-
-#ifndef __DARWIN__
- #include <windows.h>
-#endif
-
#include "wx/filename.h"
#include "wx/mac/private.h"
-#include "MoreFilesX.h"
-
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-#ifndef MAX_PATH
- #define MAX_PATH 260 // from VC++ headers
-#endif
-
-// ----------------------------------------------------------------------------
-// macros
-// ----------------------------------------------------------------------------
-
-#define M_DIR ((wxDirData *)m_data)
-
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
HFSUniStr255 uniname ;
FSRef fileRef;
FSCatalogInfo catalogInfo;
- UInt32 fetched = 0;
+ ItemCount fetched = 0;
err = FSGetCatalogInfoBulk( m_iterator, 1, &fetched, NULL, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo , &catalogInfo , &fileRef, NULL, &uniname );
+
+ // expected error codes
+
if ( errFSNoMoreItems == err )
return false ;
-
- wxASSERT( noErr == err ) ;
+ if ( afpAccessDenied == err )
+ return false ;
if ( noErr != err )
break ;
bool wxDir::Open(const wxString& dirname)
{
- delete M_DIR;
+ delete m_data;
m_data = new wxDirData(dirname);
return true;
wxString name;
if ( m_data )
{
- name = M_DIR->GetName();
+ name = m_data->GetName();
if ( !name.empty() && (name.Last() == _T('/')) )
{
// chop off the last (back)slash
wxDir::~wxDir()
{
- if (M_DIR != NULL) {
- delete M_DIR;
- m_data = NULL;
- }
+ delete m_data;
+ m_data = NULL;
}
// ----------------------------------------------------------------------------
{
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
- M_DIR->Rewind();
+ m_data->Rewind();
- M_DIR->SetFileSpec(filespec);
- M_DIR->SetFlags(flags);
+ m_data->SetFileSpec(filespec);
+ m_data->SetFlags(flags);
return GetNext(filename);
}
wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") );
- return M_DIR->Read(filename);
+ return m_data->Read(filename);
}