summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-07-17 10:21:15 (GMT)
committerJoão Abecasis <joao@abecasis.name>2009-07-22 12:36:15 (GMT)
commit316fec414c651fb4c5dc9666344219b0137e704f (patch)
treeb08309e6a87d97a4be3823c7db187d09a95f1ba4 /src/corelib
parent5f18fa27a6e87ee7cd568388cdf59cf85a3620e5 (diff)
downloadQt-316fec414c651fb4c5dc9666344219b0137e704f.zip
Qt-316fec414c651fb4c5dc9666344219b0137e704f.tar.gz
Qt-316fec414c651fb4c5dc9666344219b0137e704f.tar.bz2
QDirIterator: Don't recurse into hidden directories unless asked
If we're skipping hidden files, we should skip hidden directories as well. The user can still request that hidden directories not be skipped by specifying QDir::AllDirs in the filter. Incidentally, all other filters are ignored when recursing into sub-directories. Perhaps that should be addressed as well. Reviewed-by: Marius Storm-Olsen
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qdiriterator.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index 6d6542f..f36320e 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -244,6 +244,10 @@ bool QDirIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo)
if (QLatin1String(".") == fileName || QLatin1String("..") == fileName)
return false;
+ // No hidden directories unless requested
+ if (!(filters & QDir::AllDirs) && !(filters & QDir::Hidden) && fileInfo.isHidden())
+ return false;
+
// Stop link loops
if (visitedLinks.contains(fileInfo.canonicalFilePath()))
return false;