From 62d95b8ef57f097422862cd2fa13f5debfbc8aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 16 Jul 2009 13:34:34 +0200 Subject: QDirIterator: reducing "randomness" The difference between a canonical and absolute paths is subtle, and not what QDirIterator is about. With this change, we still avoid loops generated by symbolic links but won't duplicate entries because of these differences. While at it, when avoiding loops with symbolic links, please don't mess with the next path! That only added inconsistency. Reviewed-by: Olivier Goffart --- src/corelib/io/qdiriterator.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 44ba9507b3..d372ed39b4 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -160,16 +160,9 @@ QDirIteratorPrivate::~QDirIteratorPrivate() void QDirIteratorPrivate::pushSubDirectory(const QString &path, const QStringList &nameFilters, QDir::Filters filters) { - if (iteratorFlags & QDirIterator::FollowSymlinks) { - if (nextFileInfo.filePath() != path) - nextFileInfo.setFile(path); - if (nextFileInfo.isSymLink()) { - visitedLinks << nextFileInfo.canonicalFilePath(); - } else { - visitedLinks << nextFileInfo.absoluteFilePath(); - } - } - + if (iteratorFlags & QDirIterator::FollowSymlinks) + visitedLinks << nextFileInfo.canonicalFilePath(); + if (engine || (engine = QAbstractFileEngine::create(this->path))) { engine->setFileName(path); QAbstractFileEngineIterator *it = engine->beginEntryList(filters, nameFilters); -- cgit v1.2.3