Fixed drive handling on OS/2.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@24648 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -20,6 +20,10 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifdef __EMX__
|
||||
#define __OS2__
|
||||
#endif
|
||||
|
||||
#if wxUSE_DIRDLG
|
||||
|
||||
#include "wx/utils.h"
|
||||
@@ -66,7 +70,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __WXPM__
|
||||
#ifdef __OS2__
|
||||
|
||||
#define INCL_BASE
|
||||
#include <os2.h>
|
||||
@@ -76,7 +80,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#endif // __WXPM__
|
||||
#endif // __OS2__
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
# include "MoreFilesExtras.h"
|
||||
@@ -334,7 +338,7 @@ bool wxIsDriveAvailable(const wxString& dirName)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#elif defined(__WINDOWS__) || defined(__WXPM__)
|
||||
#elif defined(__WINDOWS__) || defined(__OS2__)
|
||||
|
||||
int setdrive(int drive)
|
||||
{
|
||||
@@ -342,13 +346,18 @@ int setdrive(int drive)
|
||||
(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1)
|
||||
return _chdrive(drive);
|
||||
#else
|
||||
wxChar newdrive[3];
|
||||
wxChar newdrive[4];
|
||||
|
||||
if (drive < 1 || drive > 31)
|
||||
return -1;
|
||||
newdrive[0] = (wxChar)(wxT('A') + drive - 1);
|
||||
newdrive[1] = wxT(':');
|
||||
#ifdef __OS2__
|
||||
newdrive[2] = wxT('\\');
|
||||
newdrive[3] = wxT('\0');
|
||||
#else
|
||||
newdrive[2] = wxT('\0');
|
||||
#endif
|
||||
#if defined(__WXMSW__)
|
||||
#ifdef __WIN16__
|
||||
if (wxSetWorkingDirectory(newdrive))
|
||||
@@ -357,7 +366,7 @@ int setdrive(int drive)
|
||||
#endif
|
||||
#else
|
||||
// VA doesn't know what LPSTR is and has its own set
|
||||
if (DosSetCurrentDir((PSZ)newdrive))
|
||||
if (!DosSetCurrentDir((PSZ)newdrive))
|
||||
#endif
|
||||
return 0;
|
||||
else
|
||||
@@ -381,6 +390,11 @@ bool wxIsDriveAvailable(const wxString& dirName)
|
||||
!(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1))
|
||||
success = wxPathExists(dirNameLower);
|
||||
#else
|
||||
#if defined(__OS2__)
|
||||
// Avoid changing to drive since no media may be inserted.
|
||||
if (dirNameLower[(size_t)0] == 'a' || dirNameLower[(size_t)0] == 'b')
|
||||
return success;
|
||||
#endif
|
||||
int currentDrive = _getdrive();
|
||||
int thisDrive = (int) (dirNameLower[(size_t)0] - 'a' + 1) ;
|
||||
int err = setdrive( thisDrive ) ;
|
||||
@@ -398,7 +412,8 @@ bool wxIsDriveAvailable(const wxString& dirName)
|
||||
|
||||
return success;
|
||||
}
|
||||
#endif // __WINDOWS__ || __WXPM__
|
||||
#endif // __WINDOWS__ || __OS2__
|
||||
|
||||
|
||||
// Function which is called by quick sort. We want to override the default wxArrayString behaviour,
|
||||
// and sort regardless of case.
|
||||
@@ -549,7 +564,7 @@ bool wxGenericDirCtrl::Create(wxWindow *parent,
|
||||
|
||||
wxString rootName;
|
||||
|
||||
#if defined(__WINDOWS__) || defined(__WXPM__) || defined(__DOS__)
|
||||
#if defined(__WINDOWS__) || defined(__OS2__) || defined(__DOS__)
|
||||
rootName = _("Computer");
|
||||
#else
|
||||
rootName = _("Sections");
|
||||
@@ -602,7 +617,7 @@ void wxGenericDirCtrl::AddSection(const wxString& path, const wxString& name, in
|
||||
|
||||
void wxGenericDirCtrl::SetupSections()
|
||||
{
|
||||
#if defined(__WINDOWS__) || defined(__DOS__) || defined(__WXPM__)
|
||||
#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)
|
||||
|
||||
#ifdef __WIN32__
|
||||
wxChar driveBuffer[256];
|
||||
@@ -800,7 +815,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
|
||||
|
||||
wxString dirName(data->m_path);
|
||||
|
||||
#if defined(__WINDOWS__) || defined(__DOS__) || defined(__WXPM__)
|
||||
#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)
|
||||
// Check if this is a root directory and if so,
|
||||
// whether the drive is avaiable.
|
||||
if (!wxIsDriveAvailable(dirName))
|
||||
@@ -814,7 +829,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
|
||||
// This may take a longish time. Go to busy cursor
|
||||
wxBusyCursor busy;
|
||||
|
||||
#if defined(__WINDOWS__) || defined(__DOS__) || defined(__WXPM__)
|
||||
#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)
|
||||
if (dirName.Last() == ':')
|
||||
dirName += wxString(wxFILE_SEP_PATH);
|
||||
#endif
|
||||
@@ -934,7 +949,7 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString&
|
||||
path2 += wxString(wxFILE_SEP_PATH);
|
||||
|
||||
// In MSW or PM, case is not significant
|
||||
#if defined(__WINDOWS__) || defined(__DOS__) || defined(__WXPM__)
|
||||
#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)
|
||||
path2.MakeLower();
|
||||
#endif
|
||||
|
||||
@@ -951,7 +966,7 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString&
|
||||
childPath += wxString(wxFILE_SEP_PATH);
|
||||
|
||||
// In MSW and PM, case is not significant
|
||||
#if defined(__WINDOWS__) || defined(__DOS__) || defined(__WXPM__)
|
||||
#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)
|
||||
childPath.MakeLower();
|
||||
#endif
|
||||
|
||||
@@ -1083,7 +1098,7 @@ void wxGenericDirCtrl::FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayStri
|
||||
|
||||
wxString dirName(data->m_path);
|
||||
|
||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||
#if defined(__WXMSW__) || defined(__OS2__)
|
||||
if (dirName.Last() == ':')
|
||||
dirName += wxString(wxFILE_SEP_PATH);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user