use drives paths, not names, in the dialog to avoid confusing HandleAction() with the drive names which it fails to interpret properly

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-09-19 12:14:23 +00:00
parent af270b2773
commit e8548d99ac

View File

@@ -542,11 +542,23 @@ void wxFileListCtrl::UpdateFiles()
{
wxArrayString names, paths;
wxArrayInt icons;
size_t n, count = wxGetAvailableDrives(paths, names, icons);
const size_t count = wxGetAvailableDrives(paths, names, icons);
for (n=0; n<count; n++)
for ( size_t n = 0; n < count; n++ )
{
wxFileData *fd = new wxFileData(paths[n], names[n], wxFileData::is_drive, icons[n]);
// use paths[n] as the drive name too as our HandleAction() can't
// deal with the drive names (of the form "System (C:)") currently
// as it mistakenly treats them as file names
//
// it would be preferable to show names, and not paths, in the
// dialog just as the native dialog does but for this we must:
// a) store the item type as item data and modify HandleAction()
// to use it instead of wxDirExists() to check whether the item
// is a directory
// b) store the drives by their drive letters and not their
// descriptions as otherwise it's pretty confusing to the user
wxFileData *fd = new wxFileData(paths[n], paths[n],
wxFileData::is_drive, icons[n]);
if (Add(fd, item) != -1)
item.m_itemId++;
else