[SOLVED]Removing extra entries from QDirIterator?
-
When iterating inside a directory I also have "." and "..",(sorry forgot they're names) which is the best action to skip them?
I use the following method to skip them:@QDirIterator it(".p");
while(it.hasNext()){
it.next();
if(it.fileName()=="." || it.fileName()==".."){
continue;
}
qDebug()<<it.fileName();
}@Is there any cleaner solution?
Using Qt 5.3 on Ubuntu.
-
Hi,
Just use the QDir::NoDotAndDotDot filter when constructing your QDirIterator and you should be good
-
Thank you, though QDir::NoDotAndDotDot stopped the iterator from showing anything, so I used QDir::Files and it's just the files without the special entries.