X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..192c3efa7f0ee383ec5e5c12877627d6c20498a7:/src/mgl/dirmgl.cpp diff --git a/src/mgl/dirmgl.cpp b/src/mgl/dirmgl.cpp index 9f618b4283..8405be0bdd 100644 --- a/src/mgl/dirmgl.cpp +++ b/src/mgl/dirmgl.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: mgl/dir.cpp +// Name: src/mgl/dir.cpp // Purpose: wxDir implementation for MGL // Author: Vaclav Slavik, Vadim Zeitlin // Modified by: @@ -7,21 +7,9 @@ // RCS-ID: $Id$ // Copyright: (c) 1999 Vadim Zeitlin // (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "dir.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -29,7 +17,13 @@ #pragma hdrstop #endif -#include "wx/defs.h" +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- #ifndef __UNIX__ @@ -93,7 +87,7 @@ wxDirData::wxDirData(const wxString& dirname) // throw away the trailing slashes size_t n = m_dirname.length(); - wxCHECK_RET( n, _T("empty dir name in wxDir") ); + wxCHECK_RET( n, wxT("empty dir name in wxDir") ); while ( n > 0 && m_dirname[--n] == wxFILE_SEP_PATH ) {} @@ -109,8 +103,8 @@ wxDirData::~wxDirData() void wxDirData::SetFileSpec(const wxString& filespec) { #ifdef __DOS__ - if ( filespec.IsEmpty() ) - m_filespec = _T("*.*"); + if ( filespec.empty() ) + m_filespec = wxT("*.*"); else #endif m_filespec = filespec; @@ -128,10 +122,10 @@ void wxDirData::Rewind() bool wxDirData::Read(wxString *filename) { PM_findData data; - bool matches = FALSE; + bool matches = false; data.dwSize = sizeof(data); - + wxString path = m_dirname; path += wxFILE_SEP_PATH; path.reserve(path.length() + 255); // speed up string concatenation @@ -141,7 +135,7 @@ bool wxDirData::Read(wxString *filename) if ( m_dir ) { if ( !PM_findNextFile(m_dir, &data) ) - return FALSE; + return false; } else { @@ -149,7 +143,7 @@ bool wxDirData::Read(wxString *filename) if ( m_dir == PM_FILE_INVALID ) { m_dir = NULL; - return FALSE; + return false; } } @@ -177,23 +171,12 @@ bool wxDirData::Read(wxString *filename) continue; } - matches = m_flags & wxDIR_HIDDEN ? TRUE : !(data.attrib & PM_FILE_HIDDEN); + matches = m_flags & wxDIR_HIDDEN ? true : !(data.attrib & PM_FILE_HIDDEN); } *filename = data.name; - return TRUE; -} - - -// ---------------------------------------------------------------------------- -// wxDir helpers -// ---------------------------------------------------------------------------- - -/* static */ -bool wxDir::Exists(const wxString& dir) -{ - return wxPathExists(dir); + return true; } // ---------------------------------------------------------------------------- @@ -211,15 +194,15 @@ bool wxDir::Open(const wxString& dirname) { delete M_DIR; m_data = NULL; - + if ( !wxDir::Exists(dirname) ) { wxLogError(_("Directory '%s' doesn't exist!"), dirname.c_str()); - return FALSE; + return false; } - + m_data = new wxDirData(dirname); - return TRUE; + return true; } bool wxDir::IsOpened() const @@ -256,7 +239,7 @@ bool wxDir::GetFirst(wxString *filename, const wxString& filespec, int flags) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, wxT("must wxDir::Open() first") ); M_DIR->Rewind(); @@ -268,12 +251,11 @@ bool wxDir::GetFirst(wxString *filename, bool wxDir::GetNext(wxString *filename) const { - wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") ); + wxCHECK_MSG( IsOpened(), false, wxT("must wxDir::Open() first") ); - wxCHECK_MSG( filename, FALSE, _T("bad pointer in wxDir::GetNext()") ); + wxCHECK_MSG( filename, false, wxT("bad pointer in wxDir::GetNext()") ); return M_DIR->Read(filename); } #endif // !__UNIX__ -