From 9313ab93e9a4bb7122358313f7827f4ea628e526 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 19 Jul 2013 08:42:58 +0200 Subject: [PATCH] Always use QDir::exists() for checking if something exists If there is a custom file engine in use by the application then it will not be able to tell if the file exists if the system stat() call is used. Therefore we let it use QDir::exists() on all platforms to ensure that this is taken care of. Change-Id: I0c93cfdad1e71b40512bcf1766de6a705a76bd9c Reviewed-by: Marcus Tillmanns Reviewed-by: Alan Alpert --- src/qml/qml/qqmltypeloader.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 8d8503f..38ee921 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -1683,14 +1683,7 @@ QString QQmlTypeLoader::absoluteFilePath(const QString &path) StringSet **fileSet = m_importDirCache.value(QHashedStringRef(dirPath.constData(), dirPath.length())); if (!fileSet) { QHashedString dirPathString(dirPath.toString()); - bool exists = false; -#ifdef Q_OS_UNIX - struct stat statBuf; - if (::stat(QFile::encodeName(dirPathString).constData(), &statBuf) == 0) - exists = S_ISDIR(statBuf.st_mode); -#else - exists = QDir(dirPathString).exists(); -#endif + bool exists = QDir(dirPathString).exists(); QStringHash *files = exists ? new QStringHash : 0; m_importDirCache.insert(dirPathString, files); fileSet = m_importDirCache.value(dirPathString); @@ -1755,14 +1748,7 @@ bool QQmlTypeLoader::directoryExists(const QString &path) StringSet **fileSet = m_importDirCache.value(QHashedStringRef(dirPath.constData(), dirPath.length())); if (!fileSet) { QHashedString dirPathString(dirPath.toString()); - bool exists = false; -#ifdef Q_OS_UNIX - struct stat statBuf; - if (::stat(QFile::encodeName(dirPathString).constData(), &statBuf) == 0) - exists = S_ISDIR(statBuf.st_mode); -#else - exists = QDir(dirPathString).exists(); -#endif + bool exists = QDir(dirPathString).exists(); QStringHash *files = exists ? new QStringHash : 0; m_importDirCache.insert(dirPathString, files); fileSet = m_importDirCache.value(dirPathString); -- 2.7.4