From 7328394a2afaf3519424ae3280c51cd8d2c10f9f Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 17 Oct 2000 17:15:18 +0000 Subject: [PATCH] Made wxGenericDirCtrl compile with Cygwin git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/dirctrlg.h | 1 - src/generic/dirctrlg.cpp | 40 ++++++++++------------------------- src/makeg95.env | 2 +- 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/include/wx/generic/dirctrlg.h b/include/wx/generic/dirctrlg.h index e383a0dc4c..0d391fea6e 100644 --- a/include/wx/generic/dirctrlg.h +++ b/include/wx/generic/dirctrlg.h @@ -49,7 +49,6 @@ class WXDLLEXPORT wxDirItemDataEx : public wxTreeItemData public: wxDirItemDataEx(const wxString& path, const wxString& name, bool isDir); ~wxDirItemDataEx(); - bool HasSubDirs(); void SetNewDirName( wxString path ); wxString m_path, m_name; bool m_isHidden; diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index d20e028b0d..5ea3910aee 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -48,11 +48,15 @@ #ifdef __WXMSW__ #include + +#ifndef __GNUWIN32__ #include #include #include #endif +#endif + #ifdef __BORLANDC__ #include "dos.h" #endif @@ -293,7 +297,7 @@ static const int ID_CANCEL = 1003; static const int ID_NEW = 1004; //static const int ID_CHECK = 1005; -#ifdef __WXMSW__ +#if defined(__WXMSW__) static bool wxIsDriveAvailable(const wxString dirName) { #ifdef __WIN32__ @@ -306,6 +310,9 @@ static bool wxIsDriveAvailable(const wxString dirName) if (dirName.Len() == 3 && dirName[(size_t)1] == wxT(':')) { wxString dirNameLower(dirName.Lower()); +#if defined(__GNUWIN32__) + success = wxPathExists(dirNameLower); +#else int currentDrive = _getdrive(); int thisDrive = (int) (dirNameLower[(size_t)0] - 'a' + 1) ; int err = _chdrive( thisDrive ) ; @@ -315,6 +322,7 @@ static bool wxIsDriveAvailable(const wxString dirName) { success = FALSE; } +#endif } #ifdef __WIN32__ (void) SetErrorMode(errorMode); @@ -354,32 +362,6 @@ void wxDirItemDataEx::SetNewDirName( wxString 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 //----------------------------------------------------------------------------- @@ -710,8 +692,8 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId) if (!wxIsDriveAvailable(dirName)) { data->m_isExpanded = FALSE; - wxMessageBox(wxT("Sorry, this drive is not available.")); - return; + //wxMessageBox(wxT("Sorry, this drive is not available.")); + return; } #endif diff --git a/src/makeg95.env b/src/makeg95.env index a0461f5fa3..0f3115a329 100644 --- a/src/makeg95.env +++ b/src/makeg95.env @@ -18,7 +18,7 @@ MINGW32=1 MINGW32VERSION=2.95 # If building DLL, the version -WXVERSION=22_0 +WXVERSION=23_0 # 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 -- 2.45.2