QDir entryInfoList and NoDotAndDotDot filter
Hi
I am trying to traverse a directory so I made the following code:
Code:
qDebug() << "dirName(): " << root.dirName() << ", absolutePath(): " << root.absolutePath();
//http://doc.trolltech.com/4.4/qdir.html#Filter-enum
QFileInfoList fList
= root.
entryInfoList(QDir::NoDotAndDotDot,
QDir::DirsFirst);
for(int i=0;i < fList.size(); ++i)
{
if(file.isDir())
qDebug() << "- (dir): " << file.absoluteFilePath();
else
qDebug() << "- : " << file.absoluteFilePath();
}
However, this returns an empty list. If I disabled the NoDotAndDotDot filter it show the directory correctly (including the dot and dotdot I want to filter). Anyone know what I am doing wrong? Perhaps I have misinterpreted the function of the NoDotAndDotDot filter?
I appreciate any feedback on this issue. Thanks!
Re: QDir entryInfoList and NoDotAndDotDot filter
try this
Code:
...
QFileInfoList fList
= root.
entryInfoList(QDir::AllDirs |
QDir::NoDotAndDotDot,
QDir::DirsFirst);
...