+ if ( VolIsEjectable(&volParmsInfo) )
+ icon_ids.Add(wxFileIconsTable::cdrom);
+ else
+ icon_ids.Add(wxFileIconsTable::drive);
+ }
+ ::HUnlock( (Handle)theVolRefs );
+ ::DisposeHandle( (Handle)theVolRefs );
+ }
+#else // !__DARWIN__
+ FSSpec volume;
+ short index = 1;
+ while(1)
+ {
+ short actualCount = 0 ;
+ if (OnLine(&volume, 1, &actualCount, &index ) != noErr || actualCount==0)
+ {
+ break;
+ }
+
+ wxString name = wxMacFSSpec2MacFilename( &volume );
+ paths.Add(name + wxFILE_SEP_PATH);
+ names.Add(name);
+ icon_ids.Add(wxFileIconsTable::drive);
+ }
+#endif // __DARWIN__
+
+#elif defined(__UNIX__)
+ paths.Add(wxT("/"));
+ names.Add(wxT("/"));
+ icon_ids.Add(wxFileIconsTable::computer);
+#else
+ #error "Unsupported platform in wxGenericDirCtrl!"
+#endif
+ return paths.GetCount();
+}
+
+// ----------------------------------------------------------------------------
+// wxIsDriveAvailable
+// ----------------------------------------------------------------------------
+
+#if defined(__DOS__)
+
+bool wxIsDriveAvailable(const wxString& dirName)
+{
+ // FIXME_MGL - this method leads to hang up under Watcom for some reason
+#ifndef __WATCOMC__
+ if ( dirName.Len() == 3 && dirName[1u] == wxT(':') )
+ {
+ wxString dirNameLower(dirName.Lower());
+ // VS: always return TRUE for removable media, since Win95 doesn't
+ // like it when MS-DOS app accesses empty floppy drive
+ return (dirNameLower[0u] == wxT('a') ||
+ dirNameLower[0u] == wxT('b') ||
+ wxPathExists(dirNameLower));
+ }
+ else
+#endif
+ return TRUE;
+}
+
+#elif defined(__WINDOWS__) || defined(__WXPM__)
+
+int setdrive(int drive)
+{
+#if defined(__GNUWIN32__) && \
+ (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1)
+ return _chdrive(drive);
+#else
+ wxChar newdrive[3];
+
+ if (drive < 1 || drive > 31)
+ return -1;
+ newdrive[0] = (wxChar)(wxT('A') + drive - 1);
+ newdrive[1] = wxT(':');
+ newdrive[2] = wxT('\0');
+#if defined(__WXMSW__)
+#ifdef __WIN16__
+ if (wxSetWorkingDirectory(newdrive))
+#else
+ if (::SetCurrentDirectory(newdrive))
+#endif
+#else
+ // VA doesn't know what LPSTR is and has its own set
+ if (DosSetCurrentDir((PSZ)newdrive))
+#endif
+ return 0;
+ else
+ return -1;
+#endif // !GNUWIN32
+}
+
+bool wxIsDriveAvailable(const wxString& dirName)