[Qt-interest] problems with QDir::entryInfoList

Riccardo Roasio riccardo.roasio at gmail.com
Thu May 20 10:07:03 CEST 2010


Hi,

i have some problems with QDir::entryInfoList. It is not working for me.
Here is the code:

QDir d=QDir(dir.absolutePath()+"/Cache");
std::cout<<"DIR: "<<d.absolutePath().toStdString()<<std::endl;
QFileInfoList list=d.entryInfoList(QDir::AllDirs, QDir::DirsFirst);
std::cout<<list.count()<<std::endl;
for (int i = 0; i < list.count(); i++)
{
   if(list.at(i).isDir())
     {std::cout<<list.at(i).dir().dirName().toStdString()<<std::endl;}
   else
     {std::cout<<list.at(i).fileName().toStdString()<<std::endl;}
}

and here is the result:

DIR: /home/citec/development/Qt/NWMInstaller/Cache
3
Cache
Cache
Cache


It gives me Cache three times while in the Cache dir there are 1
directory WTB and 1 file asd

Why this happens?

Thanks,
Riccardo



More information about the Qt-interest-old mailing list