diff options
author | João Abecasis <joao@abecasis.name> | 2009-07-16 11:34:34 (GMT) |
---|---|---|
committer | João Abecasis <joao@abecasis.name> | 2009-07-17 17:05:04 (GMT) |
commit | 62d95b8ef57f097422862cd2fa13f5debfbc8aae (patch) | |
tree | a2e16b27fbae765043fedea527a2af16db3fe4e8 /src/corelib | |
parent | af643f0612f7bd560ccb94cdce91395fc4c9acdb (diff) | |
download | Qt-62d95b8ef57f097422862cd2fa13f5debfbc8aae.zip Qt-62d95b8ef57f097422862cd2fa13f5debfbc8aae.tar.gz Qt-62d95b8ef57f097422862cd2fa13f5debfbc8aae.tar.bz2 |
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
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qdiriterator.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 44ba950..d372ed3 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); |