Deprecate wxPathExists, make wxDirExists used everywhere, minor source cleaning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33350 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
749a05ee85
commit
da865fdd32
@ -49,7 +49,7 @@ void NodeInfo::Read(const wxString& filename, wxPathList& list)
|
|||||||
|
|
||||||
for (size_t i = 0; i < tf.GetLineCount(); i++)
|
for (size_t i = 0; i < tf.GetLineCount(); i++)
|
||||||
{
|
{
|
||||||
if (tf[i].IsEmpty() || tf[i][0u] == _T('#')) continue;
|
if (tf[i].empty() || tf[i][0u] == _T('#')) continue;
|
||||||
wxStringTokenizer tkn(tf[i], _T(' '));
|
wxStringTokenizer tkn(tf[i], _T(' '));
|
||||||
wxString s = tkn.GetNextToken();
|
wxString s = tkn.GetNextToken();
|
||||||
if (s == _T("node"))
|
if (s == _T("node"))
|
||||||
@ -153,7 +153,7 @@ void NodesDb::Load()
|
|||||||
|
|
||||||
void NodesDb::LoadDir(const wxString& path)
|
void NodesDb::LoadDir(const wxString& path)
|
||||||
{
|
{
|
||||||
if (!wxPathExists(path)) return;
|
if (!wxDirExists(path)) return;
|
||||||
|
|
||||||
wxDir dir(path);
|
wxDir dir(path);
|
||||||
wxString filename;
|
wxString filename;
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
wxWidgets 2.5 Change Log - For more verbose changes, see the manual
|
wxWidgets 2.5 Change Log - For more verbose changes, see the manual
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
|
|
||||||
|
2.6
|
||||||
|
-----
|
||||||
|
|
||||||
|
All:
|
||||||
|
|
||||||
|
- wxPathExists deprecated, use wxDirExists instead.
|
||||||
|
|
||||||
2.5.5
|
2.5.5
|
||||||
-----
|
-----
|
||||||
|
|
||||||
@ -121,8 +128,8 @@ All:
|
|||||||
- wxGetPowerType() and wxGetBatteryState() addition
|
- wxGetPowerType() and wxGetBatteryState() addition
|
||||||
- wxSystemSettings::GetSystem*() members deprecated and replaced with
|
- wxSystemSettings::GetSystem*() members deprecated and replaced with
|
||||||
wxSystemSettings::Get*()
|
wxSystemSettings::Get*()
|
||||||
- wxWindowBase::DoGetBestSize now includes the difference (if any) between
|
- wxWindowBase::DoGetBestSize now includes the difference (if any) between
|
||||||
the client size and total size of the window. Code that sets the
|
the client size and total size of the window. Code that sets the
|
||||||
client size using the best size, or that added extra space to sizers
|
client size using the best size, or that added extra space to sizers
|
||||||
to compensate for this bug may need to be changed.
|
to compensate for this bug may need to be changed.
|
||||||
- Changed calculation of scrolling area to not clip away some bits
|
- Changed calculation of scrolling area to not clip away some bits
|
||||||
|
@ -190,7 +190,7 @@ the corresponding topic.
|
|||||||
\helpref{wxOnAssert}{wxonassert}\\
|
\helpref{wxOnAssert}{wxonassert}\\
|
||||||
\helpref{wxOpenClipboard}{wxopenclipboard}\\
|
\helpref{wxOpenClipboard}{wxopenclipboard}\\
|
||||||
\helpref{wxParseCommonDialogsFilter}{wxparsecommondialogsfilter}\\
|
\helpref{wxParseCommonDialogsFilter}{wxparsecommondialogsfilter}\\
|
||||||
\helpref{wxPathExists}{functionwxpathexists}\\
|
\helpref{wxDirExists}{functionwxdirexists}\\
|
||||||
\helpref{wxPathOnly}{wxpathonly}\\
|
\helpref{wxPathOnly}{wxpathonly}\\
|
||||||
\helpref{wxPostDelete}{wxpostdelete}\\
|
\helpref{wxPostDelete}{wxpostdelete}\\
|
||||||
\helpref{wxPostEvent}{wxpostevent}\\
|
\helpref{wxPostEvent}{wxpostevent}\\
|
||||||
@ -1048,9 +1048,9 @@ Returns true if the argument is an absolute filename, i.e. with a slash
|
|||||||
or drive name at the beginning.
|
or drive name at the beginning.
|
||||||
|
|
||||||
|
|
||||||
\membersection{::wxPathExists}\label{functionwxpathexists}
|
\membersection{::wxDirExists}\label{functionwxdirexists}
|
||||||
|
|
||||||
\func{bool}{wxPathExists}{\param{const wxString\& }{dirname}}
|
\func{bool}{wxDirExists}{\param{const wxString\& }{dirname}}
|
||||||
|
|
||||||
Returns true if the path exists.
|
Returns true if the path exists.
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ const int wxInvalidOffset = -1;
|
|||||||
WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename);
|
WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename);
|
||||||
|
|
||||||
// does the path exist? (may have or not '/' or '\\' at the end)
|
// does the path exist? (may have or not '/' or '\\' at the end)
|
||||||
WXDLLIMPEXP_BASE bool wxPathExists(const wxChar *pszPathName);
|
WXDLLIMPEXP_BASE bool wxDirExists(const wxChar *pszPathName);
|
||||||
|
|
||||||
WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename);
|
WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename);
|
||||||
|
|
||||||
@ -462,7 +462,14 @@ WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd);
|
|||||||
WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp);
|
WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp);
|
||||||
|
|
||||||
// compatibility defines, don't use in new code
|
// compatibility defines, don't use in new code
|
||||||
#define wxDirExists wxPathExists
|
// consider removal droping 2.4 compatibility
|
||||||
|
// #if WXWIN_COMPATIBILITY_2_4
|
||||||
|
wxDEPRECATED( inline bool wxPathExists(const wxChar *pszPathName) );
|
||||||
|
inline bool wxPathExists(const wxChar *pszPathName)
|
||||||
|
{
|
||||||
|
return wxDirExists(pszPathName);
|
||||||
|
}
|
||||||
|
// #endif //WXWIN_COMPATIBILITY_2_4
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// separators in file names
|
// separators in file names
|
||||||
|
@ -1195,7 +1195,7 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// does the path exists? (may have or not '/' or '\\' at the end)
|
// does the path exists? (may have or not '/' or '\\' at the end)
|
||||||
bool wxPathExists(const wxChar *pszPathName)
|
bool wxDirExists(const wxChar *pszPathName)
|
||||||
{
|
{
|
||||||
wxString strPath(pszPathName);
|
wxString strPath(pszPathName);
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ bool wxFileName::DirExists() const
|
|||||||
|
|
||||||
bool wxFileName::DirExists( const wxString &dir )
|
bool wxFileName::DirExists( const wxString &dir )
|
||||||
{
|
{
|
||||||
return ::wxPathExists( dir );
|
return ::wxDirExists( dir );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -259,7 +259,7 @@ bool wxIsDriveAvailable(const wxString& dirName)
|
|||||||
// like it when MS-DOS app accesses empty floppy drive
|
// like it when MS-DOS app accesses empty floppy drive
|
||||||
return (dirNameLower[0u] == wxT('a') ||
|
return (dirNameLower[0u] == wxT('a') ||
|
||||||
dirNameLower[0u] == wxT('b') ||
|
dirNameLower[0u] == wxT('b') ||
|
||||||
wxPathExists(dirNameLower));
|
wxDirExists(dirNameLower));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -318,7 +318,7 @@ bool wxIsDriveAvailable(const wxString& dirName)
|
|||||||
{
|
{
|
||||||
wxString dirNameLower(dirName.Lower());
|
wxString dirNameLower(dirName.Lower());
|
||||||
#if defined(__GNUWIN32__) && !(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1)
|
#if defined(__GNUWIN32__) && !(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1)
|
||||||
success = wxPathExists(dirNameLower);
|
success = wxDirExists(dirNameLower);
|
||||||
#else
|
#else
|
||||||
#if defined(__OS2__)
|
#if defined(__OS2__)
|
||||||
// Avoid changing to drive since no media may be inserted.
|
// Avoid changing to drive since no media may be inserted.
|
||||||
|
@ -216,7 +216,7 @@ void wxGenericDirDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
m_path = m_input->GetValue();
|
m_path = m_input->GetValue();
|
||||||
// Does the path exist? (User may have typed anything in m_input)
|
// Does the path exist? (User may have typed anything in m_input)
|
||||||
if (wxPathExists(m_path)) {
|
if (wxDirExists(m_path)) {
|
||||||
// OK, path exists, we're done.
|
// OK, path exists, we're done.
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
return;
|
return;
|
||||||
@ -320,7 +320,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) )
|
|||||||
if (!wxEndsWithPathSeparator(path))
|
if (!wxEndsWithPathSeparator(path))
|
||||||
path += wxFILE_SEP_PATH;
|
path += wxFILE_SEP_PATH;
|
||||||
path += new_name;
|
path += new_name;
|
||||||
if (wxPathExists(path))
|
if (wxDirExists(path))
|
||||||
{
|
{
|
||||||
// try NewName0, NewName1 etc.
|
// try NewName0, NewName1 etc.
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -335,7 +335,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) )
|
|||||||
path += wxFILE_SEP_PATH;
|
path += wxFILE_SEP_PATH;
|
||||||
path += new_name;
|
path += new_name;
|
||||||
i++;
|
i++;
|
||||||
} while (wxPathExists(path));
|
} while (wxDirExists(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogNull log;
|
wxLogNull log;
|
||||||
|
@ -695,7 +695,7 @@ void wxFileCtrl::GoToHomeDir()
|
|||||||
|
|
||||||
void wxFileCtrl::GoToDir( const wxString &dir )
|
void wxFileCtrl::GoToDir( const wxString &dir )
|
||||||
{
|
{
|
||||||
if (!wxPathExists(dir)) return;
|
if (!wxDirExists(dir)) return;
|
||||||
|
|
||||||
m_dirName = dir;
|
m_dirName = dir;
|
||||||
UpdateFiles();
|
UpdateFiles();
|
||||||
@ -1225,7 +1225,7 @@ void wxGenericFileDialog::OnSelected( wxListEvent &event )
|
|||||||
if (!IsTopMostDir(dir))
|
if (!IsTopMostDir(dir))
|
||||||
dir += wxFILE_SEP_PATH;
|
dir += wxFILE_SEP_PATH;
|
||||||
dir += filename;
|
dir += filename;
|
||||||
if (wxPathExists(dir)) return;
|
if (wxDirExists(dir)) return;
|
||||||
|
|
||||||
ignoreChanges = true;
|
ignoreChanges = true;
|
||||||
m_text->SetValue( filename );
|
m_text->SetValue( filename );
|
||||||
@ -1287,7 +1287,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
|
|||||||
filename = dir;
|
filename = dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wxPathExists(filename))
|
if (wxDirExists(filename))
|
||||||
{
|
{
|
||||||
m_list->GoToDir( filename );
|
m_list->GoToDir( filename );
|
||||||
UpdateControls();
|
UpdateControls();
|
||||||
|
@ -259,7 +259,7 @@ bool wxExtHelpController::LoadFile(const wxString& ifile)
|
|||||||
{
|
{
|
||||||
wxString newfile;
|
wxString newfile;
|
||||||
newfile << WXEXTHELP_SEPARATOR << wxGetLocale()->GetName();
|
newfile << WXEXTHELP_SEPARATOR << wxGetLocale()->GetName();
|
||||||
if(wxPathExists(newfile))
|
if(wxDirExists(newfile))
|
||||||
file = newfile;
|
file = newfile;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -267,13 +267,13 @@ bool wxExtHelpController::LoadFile(const wxString& ifile)
|
|||||||
const wxChar *cptr = wxGetLocale()->GetName().c_str();
|
const wxChar *cptr = wxGetLocale()->GetName().c_str();
|
||||||
while(*cptr && *cptr != wxT('_'))
|
while(*cptr && *cptr != wxT('_'))
|
||||||
newfile << *(cptr++);
|
newfile << *(cptr++);
|
||||||
if(wxPathExists(newfile))
|
if(wxDirExists(newfile))
|
||||||
file = newfile;
|
file = newfile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(! wxPathExists(file))
|
if(! wxDirExists(file))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mapFile << file << WXEXTHELP_SEPARATOR << WXEXTHELP_MAPFILE;
|
mapFile << file << WXEXTHELP_SEPARATOR << WXEXTHELP_MAPFILE;
|
||||||
|
@ -195,7 +195,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
|
|
||||||
if ( style & wxSAVE )
|
if ( style & wxSAVE )
|
||||||
{
|
{
|
||||||
if ( !defaultDir.IsEmpty() )
|
if ( !defaultDir.empty() )
|
||||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
|
||||||
wxConvFileName->cWX2MB(defaultDir));
|
wxConvFileName->cWX2MB(defaultDir));
|
||||||
|
|
||||||
@ -204,10 +204,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !defaultFileName.IsEmpty() )
|
if ( !defaultFileName.empty() )
|
||||||
{
|
{
|
||||||
wxString dir;
|
wxString dir;
|
||||||
if ( defaultDir.IsEmpty() )
|
if ( defaultDir.empty() )
|
||||||
dir = ::wxGetCwd();
|
dir = ::wxGetCwd();
|
||||||
else
|
else
|
||||||
dir = defaultDir;
|
dir = defaultDir;
|
||||||
@ -216,7 +216,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
GTK_FILE_CHOOSER(m_widget),
|
GTK_FILE_CHOOSER(m_widget),
|
||||||
wxConvFileName->cWX2MB( wxFileName(dir, defaultFileName).GetFullPath() ) );
|
wxConvFileName->cWX2MB( wxFileName(dir, defaultFileName).GetFullPath() ) );
|
||||||
}
|
}
|
||||||
else if ( !defaultDir.IsEmpty() )
|
else if ( !defaultDir.empty() )
|
||||||
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
|
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
|
||||||
wxConvFileName->cWX2MB(defaultDir) );
|
wxConvFileName->cWX2MB(defaultDir) );
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ void wxFileDialog::SetDirectory(const wxString& dir)
|
|||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
if (wxPathExists(dir))
|
if (wxDirExists(dir))
|
||||||
{
|
{
|
||||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
|
|
||||||
if ( style & wxSAVE )
|
if ( style & wxSAVE )
|
||||||
{
|
{
|
||||||
if ( !defaultDir.IsEmpty() )
|
if ( !defaultDir.empty() )
|
||||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
|
||||||
wxConvFileName->cWX2MB(defaultDir));
|
wxConvFileName->cWX2MB(defaultDir));
|
||||||
|
|
||||||
@ -204,10 +204,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !defaultFileName.IsEmpty() )
|
if ( !defaultFileName.empty() )
|
||||||
{
|
{
|
||||||
wxString dir;
|
wxString dir;
|
||||||
if ( defaultDir.IsEmpty() )
|
if ( defaultDir.empty() )
|
||||||
dir = ::wxGetCwd();
|
dir = ::wxGetCwd();
|
||||||
else
|
else
|
||||||
dir = defaultDir;
|
dir = defaultDir;
|
||||||
@ -216,7 +216,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
GTK_FILE_CHOOSER(m_widget),
|
GTK_FILE_CHOOSER(m_widget),
|
||||||
wxConvFileName->cWX2MB( wxFileName(dir, defaultFileName).GetFullPath() ) );
|
wxConvFileName->cWX2MB( wxFileName(dir, defaultFileName).GetFullPath() ) );
|
||||||
}
|
}
|
||||||
else if ( !defaultDir.IsEmpty() )
|
else if ( !defaultDir.empty() )
|
||||||
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
|
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
|
||||||
wxConvFileName->cWX2MB(defaultDir) );
|
wxConvFileName->cWX2MB(defaultDir) );
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ void wxFileDialog::SetDirectory(const wxString& dir)
|
|||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
if (wxPathExists(dir))
|
if (wxDirExists(dir))
|
||||||
{
|
{
|
||||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#endif // PCH
|
#endif // PCH
|
||||||
|
|
||||||
#include "wx/dir.h"
|
#include "wx/dir.h"
|
||||||
#include "wx/filefn.h" // for wxPathExists()
|
#include "wx/filefn.h" // for wxDirExists()
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
#ifndef __DARWIN__
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -69,12 +69,12 @@ class wxDirData
|
|||||||
public:
|
public:
|
||||||
wxDirData(const wxString& dirname);
|
wxDirData(const wxString& dirname);
|
||||||
~wxDirData();
|
~wxDirData();
|
||||||
|
|
||||||
void Close() ;
|
void Close() ;
|
||||||
void SetFileSpec(const wxString& filespec) { m_filespec = filespec; }
|
void SetFileSpec(const wxString& filespec) { m_filespec = filespec; }
|
||||||
void SetFlags(int flags) { m_flags = flags; }
|
void SetFlags(int flags) { m_flags = flags; }
|
||||||
|
|
||||||
bool Read(wxString *filename); // reads the next
|
bool Read(wxString *filename); // reads the next
|
||||||
void Rewind() ;
|
void Rewind() ;
|
||||||
|
|
||||||
const wxString& GetName() const { return m_dirname; }
|
const wxString& GetName() const { return m_dirname; }
|
||||||
@ -116,7 +116,7 @@ wxDirData::~wxDirData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxDirData::Close()
|
void wxDirData::Close()
|
||||||
{
|
{
|
||||||
if ( m_iterator )
|
if ( m_iterator )
|
||||||
{
|
{
|
||||||
FSCloseIterator( m_iterator ) ;
|
FSCloseIterator( m_iterator ) ;
|
||||||
@ -124,13 +124,13 @@ void wxDirData::Close()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDirData::Rewind()
|
void wxDirData::Rewind()
|
||||||
{
|
{
|
||||||
Close() ;
|
Close() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDirData::Read(wxString *filename)
|
bool wxDirData::Read(wxString *filename)
|
||||||
{
|
{
|
||||||
wxString result;
|
wxString result;
|
||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
if ( NULL == m_iterator )
|
if ( NULL == m_iterator )
|
||||||
@ -139,17 +139,17 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
err = wxMacPathToFSRef( m_dirname , &dirRef ) ;
|
err = wxMacPathToFSRef( m_dirname , &dirRef ) ;
|
||||||
if ( err == noErr )
|
if ( err == noErr )
|
||||||
{
|
{
|
||||||
err = FSOpenIterator(&dirRef, kFSIterateFlat, &m_iterator);
|
err = FSOpenIterator(&dirRef, kFSIterateFlat, &m_iterator);
|
||||||
}
|
}
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
Close() ;
|
Close() ;
|
||||||
return FALSE ;
|
return false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString name ;
|
wxString name ;
|
||||||
|
|
||||||
while( noErr == err )
|
while( noErr == err )
|
||||||
{
|
{
|
||||||
HFSUniStr255 uniname ;
|
HFSUniStr255 uniname ;
|
||||||
@ -160,12 +160,12 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
err = FSGetCatalogInfoBulk( m_iterator, 1, &fetched, NULL, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo , &catalogInfo , &fileRef, NULL, &uniname );
|
err = FSGetCatalogInfoBulk( m_iterator, 1, &fetched, NULL, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo , &catalogInfo , &fileRef, NULL, &uniname );
|
||||||
if ( errFSNoMoreItems == err )
|
if ( errFSNoMoreItems == err )
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
wxASSERT( noErr == err ) ;
|
wxASSERT( noErr == err ) ;
|
||||||
|
|
||||||
if ( noErr != err )
|
if ( noErr != err )
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
name = wxMacHFSUniStrToString( &uniname ) ;
|
name = wxMacHFSUniStrToString( &uniname ) ;
|
||||||
|
|
||||||
if ( ( name == wxT(".") || name == wxT("..") ) && !(m_flags & wxDIR_DOTDOT) )
|
if ( ( name == wxT(".") || name == wxT("..") ) && !(m_flags & wxDIR_DOTDOT) )
|
||||||
@ -176,7 +176,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
|
|
||||||
if ( (((FileInfo*)&catalogInfo.finderInfo)->finderFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN ) )
|
if ( (((FileInfo*)&catalogInfo.finderInfo)->finderFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN ) )
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
// its a dir and we don't want it
|
// its a dir and we don't want it
|
||||||
if ( (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) && !(m_flags & wxDIR_DIRS) )
|
if ( (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) && !(m_flags & wxDIR_DIRS) )
|
||||||
continue ;
|
continue ;
|
||||||
@ -184,24 +184,24 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
// its a file but we don't want it
|
// its a file but we don't want it
|
||||||
if ( (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) == 0 && !(m_flags & wxDIR_FILES ) )
|
if ( (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) == 0 && !(m_flags & wxDIR_FILES ) )
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
if ( m_filespec.IsEmpty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") )
|
if ( m_filespec.empty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else if ( !wxMatchWild(m_filespec, name , FALSE) )
|
else if ( !wxMatchWild(m_filespec, name , false) )
|
||||||
{
|
{
|
||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
|
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
return FALSE ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
*filename = name ;
|
*filename = name ;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -211,7 +211,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
/* static */
|
/* static */
|
||||||
bool wxDir::Exists(const wxString& dir)
|
bool wxDir::Exists(const wxString& dir)
|
||||||
{
|
{
|
||||||
return wxPathExists(dir);
|
return wxDirExists(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -230,7 +230,7 @@ bool wxDir::Open(const wxString& dirname)
|
|||||||
delete M_DIR;
|
delete M_DIR;
|
||||||
m_data = new wxDirData(dirname);
|
m_data = new wxDirData(dirname);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDir::IsOpened() const
|
bool wxDir::IsOpened() const
|
||||||
@ -270,7 +270,7 @@ bool wxDir::GetFirst(wxString *filename,
|
|||||||
const wxString& filespec,
|
const wxString& filespec,
|
||||||
int flags) const
|
int flags) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
|
|
||||||
M_DIR->Rewind();
|
M_DIR->Rewind();
|
||||||
|
|
||||||
@ -282,9 +282,9 @@ bool wxDir::GetFirst(wxString *filename,
|
|||||||
|
|
||||||
bool wxDir::GetNext(wxString *filename) const
|
bool wxDir::GetNext(wxString *filename) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
|
|
||||||
wxCHECK_MSG( filename, FALSE, _T("bad pointer in wxDir::GetNext()") );
|
wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") );
|
||||||
|
|
||||||
return M_DIR->Read(filename);
|
return M_DIR->Read(filename);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#endif // PCH
|
#endif // PCH
|
||||||
|
|
||||||
#include "wx/dir.h"
|
#include "wx/dir.h"
|
||||||
#include "wx/filefn.h" // for wxPathExists()
|
#include "wx/filefn.h" // for wxDirExists()
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
#ifndef __DARWIN__
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -77,7 +77,7 @@ public:
|
|||||||
void SetFileSpec(const wxString& filespec) { m_filespec = filespec; }
|
void SetFileSpec(const wxString& filespec) { m_filespec = filespec; }
|
||||||
void SetFlags(int flags) { m_flags = flags; }
|
void SetFlags(int flags) { m_flags = flags; }
|
||||||
|
|
||||||
bool Read(wxString *filename); // reads the next
|
bool Read(wxString *filename); // reads the next
|
||||||
void Rewind() ;
|
void Rewind() ;
|
||||||
|
|
||||||
const wxString& GetName() const { return m_dirname; }
|
const wxString& GetName() const { return m_dirname; }
|
||||||
@ -109,9 +109,9 @@ wxDirData::wxDirData(const wxString& dirname)
|
|||||||
: m_dirname(dirname)
|
: m_dirname(dirname)
|
||||||
{
|
{
|
||||||
m_ok = false;
|
m_ok = false;
|
||||||
|
|
||||||
OSErr err;
|
OSErr err;
|
||||||
|
|
||||||
// throw away the trailing slashes
|
// throw away the trailing slashes
|
||||||
size_t n = m_dirname.length();
|
size_t n = m_dirname.length();
|
||||||
wxCHECK_RET( n, _T("empty dir name in wxDir") );
|
wxCHECK_RET( n, _T("empty dir name in wxDir") );
|
||||||
@ -120,14 +120,14 @@ wxDirData::wxDirData(const wxString& dirname)
|
|||||||
;
|
;
|
||||||
|
|
||||||
m_dirname.Truncate(n + 1);
|
m_dirname.Truncate(n + 1);
|
||||||
|
|
||||||
#ifdef __DARWIN__
|
#ifdef __DARWIN__
|
||||||
FSRef theRef;
|
FSRef theRef;
|
||||||
|
|
||||||
// get the FSRef associated with the POSIX path
|
// get the FSRef associated with the POSIX path
|
||||||
err = FSPathMakeRef((const UInt8 *) m_dirname.c_str(), &theRef, NULL);
|
err = FSPathMakeRef((const UInt8 *) m_dirname.c_str(), &theRef, NULL);
|
||||||
FSGetVRefNum(&theRef, &(m_CPB.hFileInfo.ioVRefNum));
|
FSGetVRefNum(&theRef, &(m_CPB.hFileInfo.ioVRefNum));
|
||||||
|
|
||||||
err = FSGetNodeID( &theRef , &m_dirId , &m_isDir ) ;
|
err = FSGetNodeID( &theRef , &m_dirId , &m_isDir ) ;
|
||||||
#else
|
#else
|
||||||
FSSpec fsspec ;
|
FSSpec fsspec ;
|
||||||
@ -151,7 +151,7 @@ wxDirData::~wxDirData()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDirData::Rewind()
|
void wxDirData::Rewind()
|
||||||
{
|
{
|
||||||
m_index = 0 ;
|
m_index = 0 ;
|
||||||
}
|
}
|
||||||
@ -159,12 +159,12 @@ void wxDirData::Rewind()
|
|||||||
bool wxDirData::Read(wxString *filename)
|
bool wxDirData::Read(wxString *filename)
|
||||||
{
|
{
|
||||||
if ( !m_isDir )
|
if ( !m_isDir )
|
||||||
return FALSE ;
|
return false ;
|
||||||
|
|
||||||
wxString result;
|
wxString result;
|
||||||
|
|
||||||
short err = noErr ;
|
short err = noErr ;
|
||||||
|
|
||||||
while ( err == noErr )
|
while ( err == noErr )
|
||||||
{
|
{
|
||||||
m_index++ ;
|
m_index++ ;
|
||||||
@ -173,7 +173,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB);
|
err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB);
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
// its hidden but we don't want it
|
// its hidden but we don't want it
|
||||||
if ( ( m_CPB.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN) )
|
if ( ( m_CPB.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN) )
|
||||||
continue ;
|
continue ;
|
||||||
@ -190,13 +190,13 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
// we have a directory
|
// we have a directory
|
||||||
if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (m_flags & wxDIR_DIRS) )
|
if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (m_flags & wxDIR_DIRS) )
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
// its a file but we don't want it
|
// its a file but we don't want it
|
||||||
if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) == 0 && !(m_flags & wxDIR_FILES ) )
|
if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) == 0 && !(m_flags & wxDIR_FILES ) )
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
wxString file = wxMacMakeStringFromPascal( m_name ) ;
|
wxString file = wxMacMakeStringFromPascal( m_name ) ;
|
||||||
if ( m_filespec.IsEmpty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") )
|
if ( m_filespec.empty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else if ( m_filespec.Length() > 1 && m_filespec.Left(1) == wxT("*") )
|
else if ( m_filespec.Length() > 1 && m_filespec.Left(1) == wxT("*") )
|
||||||
@ -217,17 +217,17 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
{
|
{
|
||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
|
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
return FALSE ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
*filename = wxMacMakeStringFromPascal( m_name ) ;
|
*filename = wxMacMakeStringFromPascal( m_name ) ;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -237,7 +237,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
/* static */
|
/* static */
|
||||||
bool wxDir::Exists(const wxString& dir)
|
bool wxDir::Exists(const wxString& dir)
|
||||||
{
|
{
|
||||||
return wxPathExists(dir);
|
return wxDirExists(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -256,12 +256,12 @@ bool wxDir::Open(const wxString& dirname)
|
|||||||
delete M_DIR;
|
delete M_DIR;
|
||||||
m_data = new wxDirData(dirname);
|
m_data = new wxDirData(dirname);
|
||||||
if (m_data->Ok())
|
if (m_data->Ok())
|
||||||
return TRUE;
|
return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete m_data;
|
delete m_data;
|
||||||
m_data = NULL;
|
m_data = NULL;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ bool wxDir::GetFirst(wxString *filename,
|
|||||||
const wxString& filespec,
|
const wxString& filespec,
|
||||||
int flags) const
|
int flags) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
|
|
||||||
M_DIR->Rewind();
|
M_DIR->Rewind();
|
||||||
|
|
||||||
@ -314,9 +314,9 @@ bool wxDir::GetFirst(wxString *filename,
|
|||||||
|
|
||||||
bool wxDir::GetNext(wxString *filename) const
|
bool wxDir::GetNext(wxString *filename) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
|
|
||||||
wxCHECK_MSG( filename, FALSE, _T("bad pointer in wxDir::GetNext()") );
|
wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") );
|
||||||
|
|
||||||
return M_DIR->Read(filename);
|
return M_DIR->Read(filename);
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ wxDirData::~wxDirData()
|
|||||||
void wxDirData::SetFileSpec(const wxString& filespec)
|
void wxDirData::SetFileSpec(const wxString& filespec)
|
||||||
{
|
{
|
||||||
#ifdef __DOS__
|
#ifdef __DOS__
|
||||||
if ( filespec.IsEmpty() )
|
if ( filespec.empty() )
|
||||||
m_filespec = _T("*.*");
|
m_filespec = _T("*.*");
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -128,10 +128,10 @@ void wxDirData::Rewind()
|
|||||||
bool wxDirData::Read(wxString *filename)
|
bool wxDirData::Read(wxString *filename)
|
||||||
{
|
{
|
||||||
PM_findData data;
|
PM_findData data;
|
||||||
bool matches = FALSE;
|
bool matches = false;
|
||||||
|
|
||||||
data.dwSize = sizeof(data);
|
data.dwSize = sizeof(data);
|
||||||
|
|
||||||
wxString path = m_dirname;
|
wxString path = m_dirname;
|
||||||
path += wxFILE_SEP_PATH;
|
path += wxFILE_SEP_PATH;
|
||||||
path.reserve(path.length() + 255); // speed up string concatenation
|
path.reserve(path.length() + 255); // speed up string concatenation
|
||||||
@ -141,7 +141,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
if ( m_dir )
|
if ( m_dir )
|
||||||
{
|
{
|
||||||
if ( !PM_findNextFile(m_dir, &data) )
|
if ( !PM_findNextFile(m_dir, &data) )
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -149,7 +149,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
if ( m_dir == PM_FILE_INVALID )
|
if ( m_dir == PM_FILE_INVALID )
|
||||||
{
|
{
|
||||||
m_dir = NULL;
|
m_dir = NULL;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,12 +177,12 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
continue;
|
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;
|
*filename = data.name;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
/* static */
|
/* static */
|
||||||
bool wxDir::Exists(const wxString& dir)
|
bool wxDir::Exists(const wxString& dir)
|
||||||
{
|
{
|
||||||
return wxPathExists(dir);
|
return wxDirExists(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -211,15 +211,15 @@ bool wxDir::Open(const wxString& dirname)
|
|||||||
{
|
{
|
||||||
delete M_DIR;
|
delete M_DIR;
|
||||||
m_data = NULL;
|
m_data = NULL;
|
||||||
|
|
||||||
if ( !wxDir::Exists(dirname) )
|
if ( !wxDir::Exists(dirname) )
|
||||||
{
|
{
|
||||||
wxLogError(_("Directory '%s' doesn't exist!"), dirname.c_str());
|
wxLogError(_("Directory '%s' doesn't exist!"), dirname.c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_data = new wxDirData(dirname);
|
m_data = new wxDirData(dirname);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDir::IsOpened() const
|
bool wxDir::IsOpened() const
|
||||||
@ -256,7 +256,7 @@ bool wxDir::GetFirst(wxString *filename,
|
|||||||
const wxString& filespec,
|
const wxString& filespec,
|
||||||
int flags) const
|
int flags) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
|
|
||||||
M_DIR->Rewind();
|
M_DIR->Rewind();
|
||||||
|
|
||||||
@ -268,9 +268,9 @@ bool wxDir::GetFirst(wxString *filename,
|
|||||||
|
|
||||||
bool wxDir::GetNext(wxString *filename) const
|
bool wxDir::GetNext(wxString *filename) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
|
|
||||||
wxCHECK_MSG( filename, FALSE, _T("bad pointer in wxDir::GetNext()") );
|
wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") );
|
||||||
|
|
||||||
return M_DIR->Read(filename);
|
return M_DIR->Read(filename);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#endif // PCH
|
#endif // PCH
|
||||||
|
|
||||||
#include "wx/dir.h"
|
#include "wx/dir.h"
|
||||||
#include "wx/filefn.h" // for wxPathExists()
|
#include "wx/filefn.h" // for wxDirExists()
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
@ -287,7 +287,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
/* static */
|
/* static */
|
||||||
bool wxDir::Exists(const wxString& dir)
|
bool wxDir::Exists(const wxString& dir)
|
||||||
{
|
{
|
||||||
return wxPathExists(dir);
|
return wxDirExists(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -119,7 +119,7 @@ static void wxFixOPENFILENAME(LPOPENFILENAME ofn)
|
|||||||
if ( (ofn->Flags & OFN_ALLOWMULTISELECT) &&
|
if ( (ofn->Flags & OFN_ALLOWMULTISELECT) &&
|
||||||
ofn->lpstrFile[ofn->nFileOffset-1] != wxT('\0') )
|
ofn->lpstrFile[ofn->nFileOffset-1] != wxT('\0') )
|
||||||
{
|
{
|
||||||
if ( wxPathExists(ofn->lpstrFile) )
|
if ( wxDirExists(ofn->lpstrFile) )
|
||||||
{
|
{
|
||||||
// 1st component is dir => multiple files selected
|
// 1st component is dir => multiple files selected
|
||||||
ofn->nFileOffset = wxStrlen(ofn->lpstrFile)+1;
|
ofn->nFileOffset = wxStrlen(ofn->lpstrFile)+1;
|
||||||
|
@ -81,7 +81,7 @@ static inline FIND_DATA FindFirst(
|
|||||||
|
|
||||||
rc = ::DosFindFirst( rsSpec.c_str()
|
rc = ::DosFindFirst( rsSpec.c_str()
|
||||||
,&hDir
|
,&hDir
|
||||||
,0x37 // was: FILE_NORMAL
|
,0x37 // was: FILE_NORMAL
|
||||||
,pFinddata
|
,pFinddata
|
||||||
,sizeof(FILEFINDBUF3)
|
,sizeof(FILEFINDBUF3)
|
||||||
,&ulFindCount
|
,&ulFindCount
|
||||||
@ -213,7 +213,7 @@ bool wxDirData::Read(
|
|||||||
wxString* psFilename
|
wxString* psFilename
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
bool bFirst = FALSE;
|
bool bFirst = false;
|
||||||
|
|
||||||
FILEFINDBUF3 vFinddata;
|
FILEFINDBUF3 vFinddata;
|
||||||
#define PTR_TO_FINDDATA (&vFinddata)
|
#define PTR_TO_FINDDATA (&vFinddata)
|
||||||
@ -234,12 +234,12 @@ bool wxDirData::Read(
|
|||||||
m_vFinddata = FindFirst( sFilespec
|
m_vFinddata = FindFirst( sFilespec
|
||||||
,PTR_TO_FINDDATA
|
,PTR_TO_FINDDATA
|
||||||
);
|
);
|
||||||
bFirst = TRUE;
|
bFirst = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !IsFindDataOk(m_vFinddata) )
|
if ( !IsFindDataOk(m_vFinddata) )
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxChar* zName;
|
const wxChar* zName;
|
||||||
@ -249,7 +249,7 @@ bool wxDirData::Read(
|
|||||||
{
|
{
|
||||||
if (bFirst)
|
if (bFirst)
|
||||||
{
|
{
|
||||||
bFirst = FALSE;
|
bFirst = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -257,7 +257,7 @@ bool wxDirData::Read(
|
|||||||
,PTR_TO_FINDDATA
|
,PTR_TO_FINDDATA
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ bool wxDirData::Read(
|
|||||||
*psFilename = zName;
|
*psFilename = zName;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
} // end of wxDirData::Read
|
} // end of wxDirData::Read
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -321,7 +321,7 @@ bool wxDir::Exists(
|
|||||||
const wxString& rsDir
|
const wxString& rsDir
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return wxPathExists(rsDir);
|
return wxDirExists(rsDir);
|
||||||
} // end of wxDir::Exists
|
} // end of wxDir::Exists
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -343,7 +343,7 @@ bool wxDir::Open(
|
|||||||
{
|
{
|
||||||
delete M_DIR;
|
delete M_DIR;
|
||||||
m_data = new wxDirData(rsDirname);
|
m_data = new wxDirData(rsDirname);
|
||||||
return TRUE;
|
return true;
|
||||||
} // end of wxDir::Open
|
} // end of wxDir::Open
|
||||||
|
|
||||||
bool wxDir::IsOpened() const
|
bool wxDir::IsOpened() const
|
||||||
@ -388,7 +388,7 @@ bool wxDir::GetFirst(
|
|||||||
, int nFlags
|
, int nFlags
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
M_DIR->Rewind();
|
M_DIR->Rewind();
|
||||||
M_DIR->SetFileSpec(rsFilespec);
|
M_DIR->SetFileSpec(rsFilespec);
|
||||||
M_DIR->SetFlags(nFlags);
|
M_DIR->SetFlags(nFlags);
|
||||||
@ -399,8 +399,8 @@ bool wxDir::GetNext(
|
|||||||
wxString* psFilename
|
wxString* psFilename
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
wxCHECK_MSG( psFilename, FALSE, _T("bad pointer in wxDir::GetNext()") );
|
wxCHECK_MSG( psFilename, false, _T("bad pointer in wxDir::GetNext()") );
|
||||||
return M_DIR->Read(psFilename);
|
return M_DIR->Read(psFilename);
|
||||||
} // end of wxDir::GetNext
|
} // end of wxDir::GetNext
|
||||||
|
|
||||||
|
@ -2299,8 +2299,8 @@ EXPORTS
|
|||||||
wxStripExtension__FPc
|
wxStripExtension__FPc
|
||||||
;wxPathOnly(const wxString&)
|
;wxPathOnly(const wxString&)
|
||||||
wxPathOnly__FRC8wxString
|
wxPathOnly__FRC8wxString
|
||||||
;wxPathExists(const char*)
|
;wxDirExists(const char*)
|
||||||
wxPathExists__FPCc
|
wxDirExists__FPCc
|
||||||
;wxPathList::FindValidPath(const wxString&)
|
;wxPathList::FindValidPath(const wxString&)
|
||||||
FindValidPath__10wxPathListFRC8wxString
|
FindValidPath__10wxPathListFRC8wxString
|
||||||
;wxPathList::FindAbsoluteValidPath(const wxString&)
|
;wxPathList::FindAbsoluteValidPath(const wxString&)
|
||||||
@ -13919,8 +13919,8 @@ EXPORTS
|
|||||||
wxDrawBorder__FUlR6_RECTLT1
|
wxDrawBorder__FUlR6_RECTLT1
|
||||||
;wxShutdown(wxShutdownFlags)
|
;wxShutdown(wxShutdownFlags)
|
||||||
wxShutdown__F15wxShutdownFlags
|
wxShutdown__F15wxShutdownFlags
|
||||||
;wxPathExists(const wxString&)
|
;wxDirExists(const wxString&)
|
||||||
wxPathExists__FRC8wxString
|
wxDirExists__FRC8wxString
|
||||||
;wxGetWindowText(unsigned long)
|
;wxGetWindowText(unsigned long)
|
||||||
wxGetWindowText__FUl
|
wxGetWindowText__FUl
|
||||||
;wxGetWindowId(unsigned long)
|
;wxGetWindowId(unsigned long)
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#endif // PCH
|
#endif // PCH
|
||||||
|
|
||||||
#include "wx/dir.h"
|
#include "wx/dir.h"
|
||||||
#include "wx/filefn.h" // for wxPathExists()
|
#include "wx/filefn.h" // for wxDirExists()
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// define the types and functions used for file searching
|
// define the types and functions used for file searching
|
||||||
|
@ -120,26 +120,26 @@ wxDirData::~wxDirData()
|
|||||||
bool wxDirData::Read(wxString *filename)
|
bool wxDirData::Read(wxString *filename)
|
||||||
{
|
{
|
||||||
dirent *de = (dirent *)NULL; // just to silence compiler warnings
|
dirent *de = (dirent *)NULL; // just to silence compiler warnings
|
||||||
bool matches = FALSE;
|
bool matches = false;
|
||||||
|
|
||||||
// speed up string concatenation in the loop a bit
|
// speed up string concatenation in the loop a bit
|
||||||
wxString path = m_dirname;
|
wxString path = m_dirname;
|
||||||
path += _T('/');
|
path += _T('/');
|
||||||
path.reserve(path.length() + 255);
|
path.reserve(path.length() + 255);
|
||||||
|
|
||||||
wxString de_d_name;
|
wxString de_d_name;
|
||||||
|
|
||||||
while ( !matches )
|
while ( !matches )
|
||||||
{
|
{
|
||||||
de = readdir(m_dir);
|
de = readdir(m_dir);
|
||||||
if ( !de )
|
if ( !de )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
de_d_name = wxConvFileName->cMB2WC( de->d_name );
|
de_d_name = wxConvFileName->cMB2WC( de->d_name );
|
||||||
#else
|
#else
|
||||||
de_d_name = de->d_name;
|
de_d_name = de->d_name;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// don't return "." and ".." unless asked for
|
// don't return "." and ".." unless asked for
|
||||||
if ( de->d_name[0] == '.' &&
|
if ( de->d_name[0] == '.' &&
|
||||||
@ -168,7 +168,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
// finally, check the name
|
// finally, check the name
|
||||||
if ( m_filespec.empty() )
|
if ( m_filespec.empty() )
|
||||||
{
|
{
|
||||||
matches = m_flags & wxDIR_HIDDEN ? TRUE : de->d_name[0] != '.';
|
matches = m_flags & wxDIR_HIDDEN ? true : de->d_name[0] != '.';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -180,7 +180,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
|
|
||||||
*filename = de_d_name;
|
*filename = de_d_name;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // old VMS (TODO)
|
#else // old VMS (TODO)
|
||||||
@ -196,7 +196,7 @@ wxDirData::~wxDirData()
|
|||||||
|
|
||||||
bool wxDirData::Read(wxString * WXUNUSED(filename))
|
bool wxDirData::Read(wxString * WXUNUSED(filename))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // not or new VMS/old VMS
|
#endif // not or new VMS/old VMS
|
||||||
@ -208,7 +208,7 @@ bool wxDirData::Read(wxString * WXUNUSED(filename))
|
|||||||
/* static */
|
/* static */
|
||||||
bool wxDir::Exists(const wxString& dir)
|
bool wxDir::Exists(const wxString& dir)
|
||||||
{
|
{
|
||||||
return wxPathExists(dir);
|
return wxDirExists(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -235,10 +235,10 @@ bool wxDir::Open(const wxString& dirname)
|
|||||||
delete M_DIR;
|
delete M_DIR;
|
||||||
m_data = NULL;
|
m_data = NULL;
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDir::IsOpened() const
|
bool wxDir::IsOpened() const
|
||||||
@ -275,7 +275,7 @@ bool wxDir::GetFirst(wxString *filename,
|
|||||||
const wxString& filespec,
|
const wxString& filespec,
|
||||||
int flags) const
|
int flags) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
|
|
||||||
M_DIR->Rewind();
|
M_DIR->Rewind();
|
||||||
|
|
||||||
@ -287,16 +287,16 @@ bool wxDir::GetFirst(wxString *filename,
|
|||||||
|
|
||||||
bool wxDir::GetNext(wxString *filename) const
|
bool wxDir::GetNext(wxString *filename) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
|
|
||||||
wxCHECK_MSG( filename, FALSE, _T("bad pointer in wxDir::GetNext()") );
|
wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") );
|
||||||
|
|
||||||
return M_DIR->Read(filename);
|
return M_DIR->Read(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDir::HasSubDirs(const wxString& spec)
|
bool wxDir::HasSubDirs(const wxString& spec)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, _T("must wxDir::Open() first") );
|
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
|
||||||
|
|
||||||
if ( spec.empty() )
|
if ( spec.empty() )
|
||||||
{
|
{
|
||||||
@ -317,7 +317,7 @@ bool wxDir::HasSubDirs(const wxString& spec)
|
|||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
// just "." and ".."
|
// just "." and ".."
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
@ -329,7 +329,7 @@ bool wxDir::HasSubDirs(const wxString& spec)
|
|||||||
// assume we have subdirs - may turn out to be wrong if we
|
// assume we have subdirs - may turn out to be wrong if we
|
||||||
// have other hard links to this directory but it's not
|
// have other hard links to this directory but it's not
|
||||||
// that bad as explained above
|
// that bad as explained above
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -912,7 +912,7 @@ void ArchiveTestCase<ClassFactoryT>::VerifyDir(wxString& path,
|
|||||||
name = m_factory->GetInternalName(
|
name = m_factory->GetInternalName(
|
||||||
path.substr(rootlen, wxString::npos));
|
path.substr(rootlen, wxString::npos));
|
||||||
|
|
||||||
bool isDir = wxPathExists(path);
|
bool isDir = wxDirExists(path);
|
||||||
if (isDir)
|
if (isDir)
|
||||||
name += _T("/");
|
name += _T("/");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user