PDA

View Full Version : Qt4: QDir::entryList bug in windows when listing network files?



Yvon Halbwachs
25th April 2006, 14:06
Hi,

I'm trying to iterate on files in a directory using QDir::entryList using Qt4.1.2 in Windows. I can find files located on a hdd drive (like C:\ ), but I get nothing when listing files from a network-drive (like //host/name).

Am I doing something wrong? It worked fine earlier in Qt3! Is this a Qt4.1.2 bug? :(

Yvon

e8johan
5th May 2006, 09:14
Searching the TaskTracker gives nothing: http://www.trolltech.com/developer/task-tracker/index_html?searchstr=qdir+unc&method=advsearch&bugs=on&sugs=on . From task 94416 it sounds as if UNC really works, but the description uses the "\\xxx\xxx\xxx"-notation instead of "//xxx/xxx/xxx". Could that be it?

Yvon Halbwachs
12th May 2006, 14:22
Hi,

No that's not it because I don't specify the path myself, I only use the currentPath.

Here is a little example of the problem. It tries to find all the xml files from the directory where it is started from. It works fine on hard disk drive like C: , but not from networked drives.


int main(int argc, char** argv)
{

QApplication a(argc, argv);

QDir dir;
QStringList xml_filters;
xml_filters << "*.xml";

QStringList xml_files = dir.entryList(xml_filters, QDir::Files | QDir::Readable);

if (xml_files.count() == 0) {

QMessageBox::critical(0, "Error", "Cannot find any xml file",
QMessageBox::Ok, QMessageBox::NoButton);
return 1; }
else {

QMessageBox::information(0, "Ok", QString("Found %1 xml files.").arg(xml_files.count()),
QMessageBox::Ok, QMessageBox::NoButton); }
return 0;}

Is this a bug? Am I missing something?

Yvon