aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2013-07-19 08:42:58 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-25 11:36:01 +0200
commit9313ab93e9a4bb7122358313f7827f4ea628e526 (patch)
tree44d8a9a19b75194077bc99a1eb87b9fc9d2c913b /src
parent3f01f6ff0396148e753066f481b3828522a94514 (diff)
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 <maddimax@gmail.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/qqmltypeloader.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 8d8503f344..38ee9211f8 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<bool> *files = exists ? new QStringHash<bool> : 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<bool> *files = exists ? new QStringHash<bool> : 0;
m_importDirCache.insert(dirPathString, files);
fileSet = m_importDirCache.value(dirPathString);