Made wxGenericDirCtrl compile with Cygwin

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-10-17 17:15:18 +00:00
parent 8f5bda17b3
commit 7328394a2a
3 changed files with 12 additions and 31 deletions

View File

@@ -49,7 +49,6 @@ class WXDLLEXPORT wxDirItemDataEx : public wxTreeItemData
public: public:
wxDirItemDataEx(const wxString& path, const wxString& name, bool isDir); wxDirItemDataEx(const wxString& path, const wxString& name, bool isDir);
~wxDirItemDataEx(); ~wxDirItemDataEx();
bool HasSubDirs();
void SetNewDirName( wxString path ); void SetNewDirName( wxString path );
wxString m_path, m_name; wxString m_path, m_name;
bool m_isHidden; bool m_isHidden;

View File

@@ -48,11 +48,15 @@
#ifdef __WXMSW__ #ifdef __WXMSW__
#include <windows.h> #include <windows.h>
#ifndef __GNUWIN32__
#include <direct.h> #include <direct.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#endif #endif
#endif
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#include "dos.h" #include "dos.h"
#endif #endif
@@ -293,7 +297,7 @@ static const int ID_CANCEL = 1003;
static const int ID_NEW = 1004; static const int ID_NEW = 1004;
//static const int ID_CHECK = 1005; //static const int ID_CHECK = 1005;
#ifdef __WXMSW__ #if defined(__WXMSW__)
static bool wxIsDriveAvailable(const wxString dirName) static bool wxIsDriveAvailable(const wxString dirName)
{ {
#ifdef __WIN32__ #ifdef __WIN32__
@@ -306,6 +310,9 @@ static bool wxIsDriveAvailable(const wxString dirName)
if (dirName.Len() == 3 && dirName[(size_t)1] == wxT(':')) if (dirName.Len() == 3 && dirName[(size_t)1] == wxT(':'))
{ {
wxString dirNameLower(dirName.Lower()); wxString dirNameLower(dirName.Lower());
#if defined(__GNUWIN32__)
success = wxPathExists(dirNameLower);
#else
int currentDrive = _getdrive(); int currentDrive = _getdrive();
int thisDrive = (int) (dirNameLower[(size_t)0] - 'a' + 1) ; int thisDrive = (int) (dirNameLower[(size_t)0] - 'a' + 1) ;
int err = _chdrive( thisDrive ) ; int err = _chdrive( thisDrive ) ;
@@ -315,6 +322,7 @@ static bool wxIsDriveAvailable(const wxString dirName)
{ {
success = FALSE; success = FALSE;
} }
#endif
} }
#ifdef __WIN32__ #ifdef __WIN32__
(void) SetErrorMode(errorMode); (void) SetErrorMode(errorMode);
@@ -354,32 +362,6 @@ void wxDirItemDataEx::SetNewDirName( wxString path )
m_name = wxFileNameFromPath( path ); m_name = wxFileNameFromPath( path );
} }
// No longer used, and takes a very long time
bool wxDirItemDataEx::HasSubDirs()
{
if (m_path.IsEmpty())
return TRUE;
// On WIN32, must check if this volume is mounted or
// we get an error dialog for e.g. drive a:
#ifdef __WIN32__
if (!wxIsDriveAvailable(m_path))
return FALSE;
#endif
wxString search = m_path;
if (m_path.Last() != wxFILE_SEP_PATH)
{
search += wxString(wxFILE_SEP_PATH);
}
search += wxT("*");
wxLogNull log;
wxString path = wxFindFirstFile( search, wxDIR );
return (bool)(!path.IsNull());
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxGenericDirCtrl // wxGenericDirCtrl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -710,7 +692,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
if (!wxIsDriveAvailable(dirName)) if (!wxIsDriveAvailable(dirName))
{ {
data->m_isExpanded = FALSE; data->m_isExpanded = FALSE;
wxMessageBox(wxT("Sorry, this drive is not available.")); //wxMessageBox(wxT("Sorry, this drive is not available."));
return; return;
} }
#endif #endif

View File

@@ -18,7 +18,7 @@ MINGW32=1
MINGW32VERSION=2.95 MINGW32VERSION=2.95
# If building DLL, the version # If building DLL, the version
WXVERSION=22_0 WXVERSION=23_0
# Say yes if you have a "modern" linker that supports --shared option. # Say yes if you have a "modern" linker that supports --shared option.
# Note that you're probably going to wait forever for dlltool/gcc/etc # Note that you're probably going to wait forever for dlltool/gcc/etc