summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-07-16 13:34:34 +0200
committerJoão Abecasis <joao@abecasis.name>2009-07-17 19:05:04 +0200
commit62d95b8ef57f097422862cd2fa13f5debfbc8aae (patch)
treea2e16b27fbae765043fedea527a2af16db3fe4e8 /src/corelib
parentaf643f0612f7bd560ccb94cdce91395fc4c9acdb (diff)
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.cpp13
1 files changed, 3 insertions, 10 deletions
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);