use better check for drives even with Mingw32 (and, later, MSDOS)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13260 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-12-31 00:46:17 +00:00
parent 23213f1811
commit c9ecda60f5

View File

@@ -50,10 +50,14 @@
#ifdef __WXMSW__ #ifdef __WXMSW__
#include <windows.h> #include <windows.h>
#ifndef __GNUWIN32__ // FIXME - Mingw32 1.0 has both _getdrive() and _chdrive(). For now, let's assume
#include <direct.h> // older releases don't, but it should be verified and the checks modified
#include <stdlib.h> // accordingly.
#include <ctype.h> #if !defined(__GNUWIN32__) || \
(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1)
#include <direct.h>
#include <stdlib.h>
#include <ctype.h>
#endif #endif
#endif #endif
@@ -310,9 +314,13 @@ 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;
#if defined(__WXMSW__) || defined(__WXPM__) #if defined(__WXMSW__) || defined(__WXPM__) || defined(__DOS__)
int setdrive(int drive) int setdrive(int drive)
{ {
#if defined(__GNUWIN32__) && \
(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1)
return _chdrive(drive);
#else
wxChar newdrive[3]; wxChar newdrive[3];
if (drive < 1 || drive > 31) if (drive < 1 || drive > 31)
@@ -333,6 +341,7 @@ int setdrive(int drive)
return 0; return 0;
else else
return -1; return -1;
#endif // !GNUWIN32
} }
static bool wxIsDriveAvailable(const wxString dirName) static bool wxIsDriveAvailable(const wxString dirName)
@@ -347,7 +356,8 @@ 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__) #if defined(__GNUWIN32__) && \
!(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1)
success = wxPathExists(dirNameLower); success = wxPathExists(dirNameLower);
#else #else
int currentDrive = _getdrive(); int currentDrive = _getdrive();