From fbba3d5390b7c34ab80973fd9d01296c3d96c1f0 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 23 Nov 2021 09:00:00 +0200 Subject: [PATCH] do not list directory by default upon QStatInfo construction Signed-off-by: Ivailo Monev --- src/core/io/qfilesystemwatcher_unix.cpp | 8 ++++---- src/core/kernel/qcore_unix_p.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/io/qfilesystemwatcher_unix.cpp b/src/core/io/qfilesystemwatcher_unix.cpp index 80a1bae2f..d5b660008 100644 --- a/src/core/io/qfilesystemwatcher_unix.cpp +++ b/src/core/io/qfilesystemwatcher_unix.cpp @@ -43,12 +43,12 @@ QStringList QFileSystemWatcherEngineUnix::addPaths(const QStringList &paths, { QStringList p = paths; foreach (const QString &path, p) { - QStatInfo fi(path); + QStatInfo fi(path, true); if (fi.isDir() || path.endsWith(QLatin1Char('/'))) { if (!directories->contains(path)) directories->append(path); if (!path.endsWith(QLatin1Char('/'))) - fi = QStatInfo(path + QLatin1Char('/')); + fi = QStatInfo(path + QLatin1Char('/'), true); this->directories.insert(path, fi); } else { if (!files->contains(path)) @@ -107,9 +107,9 @@ void QFileSystemWatcherEngineUnix::timeout() while (dit.hasNext()) { QHash::iterator x = dit.next(); QString path = x.key(); - QStatInfo fi(path); + QStatInfo fi(path, true); if (!path.endsWith(QLatin1Char('/'))) - fi = QStatInfo(path + QLatin1Char('/')); + fi = QStatInfo(path + QLatin1Char('/'), true); if (!fi.dirEquals(x.value())) { if (!fi.exists()) { dit.remove(); diff --git a/src/core/kernel/qcore_unix_p.h b/src/core/kernel/qcore_unix_p.h index 710ffa829..2a03c913a 100644 --- a/src/core/kernel/qcore_unix_p.h +++ b/src/core/kernel/qcore_unix_p.h @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE class Q_CORE_EXPORT QStatInfo { public: - QStatInfo(const QString &path, const bool listdir = true); + QStatInfo(const QString &path, const bool listdir = false); QStatInfo(const QStatInfo &other); QStatInfo& operator=(const QStatInfo &other);