void Rewind() ;
const wxString& GetName() const { return m_dirname; }
+ bool Ok() const { return m_ok; }
private:
CInfoPBRec m_CPB ;
wxString m_filespec;
int m_flags;
+ bool m_ok;
};
// ============================================================================
wxDirData::wxDirData(const wxString& dirname)
: m_dirname(dirname)
{
+ m_ok = false;
+
OSErr err;
// throw away the trailing slashes
err = FSpGetDirectoryID( &fsspec , &m_dirId , &m_isDir ) ;
#endif
- wxASSERT_MSG( (err == noErr) || (err == nsvErr) , wxT("Error accessing directory " + m_dirname)) ;
+ //wxASSERT_MSG( (err == noErr) || (err == nsvErr) , wxT("Error accessing directory " + m_dirname)) ;
+ if ( (err == noErr) || (err == nsvErr))
+ m_ok = true;
+ else
+ wxLogError(wxString(wxT("Error accessing directory ")) + m_dirname);
m_CPB.hFileInfo.ioNamePtr = m_name ;
m_index = 0 ;
{
delete M_DIR;
m_data = new wxDirData(dirname);
-
- return TRUE;
+ if (m_data->Ok())
+ return TRUE;
+ else
+ {
+ delete m_data;
+ m_data = NULL;
+ return FALSE;
+ }
}
bool wxDir::IsOpened() const
void Rewind() ;
const wxString& GetName() const { return m_dirname; }
+ bool Ok() const { return m_ok; }
private:
CInfoPBRec m_CPB ;
wxString m_filespec;
int m_flags;
+ bool m_ok;
};
// ============================================================================
wxDirData::wxDirData(const wxString& dirname)
: m_dirname(dirname)
{
+ m_ok = false;
+
OSErr err;
// throw away the trailing slashes
err = FSpGetDirectoryID( &fsspec , &m_dirId , &m_isDir ) ;
#endif
- wxASSERT_MSG( (err == noErr) || (err == nsvErr) , wxT("Error accessing directory " + m_dirname)) ;
+ //wxASSERT_MSG( (err == noErr) || (err == nsvErr) , wxT("Error accessing directory " + m_dirname)) ;
+ if ( (err == noErr) || (err == nsvErr))
+ m_ok = true;
+ else
+ wxLogError(wxString(wxT("Error accessing directory ")) + m_dirname);
m_CPB.hFileInfo.ioNamePtr = m_name ;
m_index = 0 ;
{
delete M_DIR;
m_data = new wxDirData(dirname);
-
- return TRUE;
+ if (m_data->Ok())
+ return TRUE;
+ else
+ {
+ delete m_data;
+ m_data = NULL;
+ return FALSE;
+ }
}
bool wxDir::IsOpened() const