From 8c26773f2f0bb855a8940caaba0189cfd21f7b8d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 12 May 2014 13:14:30 +0000 Subject: [PATCH] Don't use _{get,ch}drive() functions in Cygwin builds. They are not available there when not using MinGW headers, e.g. in 64 bit builds. Also simplify the code by using wxHAS_DRIVE_FUNCTIONS instead of complicated (and sometimes negated) checks for MinGW32 version. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/dirctrlg.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index bfdf0231e6..101bef8918 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -59,15 +59,13 @@ #include "wx/msw/winundef.h" #include "wx/volume.h" -// FIXME - Mingw32 1.0 has both _getdrive() and _chdrive(). For now, let's assume -// older releases don't, but it should be verified and the checks modified -// accordingly. -#if !defined(__GNUWIN32__) || (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) -#if !defined(__WXWINCE__) - #include +// MinGW has _getdrive() and _chdrive(), Cygwin doesn't. +#if defined(__GNUWIN32__) && !defined(__CYGWIN__) + #define wxHAS_DRIVE_FUNCTIONS #endif - #include - #include + +#ifdef wxHAS_DRIVE_FUNCTIONS + #include #endif #endif // __WINDOWS__ @@ -300,8 +298,7 @@ int setdrive(int WXUNUSED_IN_WINCE(drive)) { #ifdef __WXWINCE__ return 0; -#elif defined(__GNUWIN32__) && \ - (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) +#elif defined(wxHAS_DRIVE_FUNCTIONS) return _chdrive(drive); #else wxChar newdrive[4]; @@ -343,7 +340,7 @@ bool wxIsDriveAvailable(const wxString& WXUNUSED_IN_WINCE(dirName)) if (dirName.length() == 3 && dirName[(size_t)1] == wxT(':')) { wxString dirNameLower(dirName.Lower()); -#if defined(__GNUWIN32__) && !(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) +#ifndef wxHAS_DRIVE_FUNCTIONS success = wxDirExists(dirNameLower); #else #if defined(__OS2__)