diff options
author | Tobias Koenig <tobias.koenig@kdab.com> | 2016-01-19 14:22:28 +0100 |
---|---|---|
committer | Tobias Koenig <tobias.koenig@kdab.com> | 2016-01-21 21:21:47 +0000 |
commit | a01146aac104b05dcf5c7ddbe7b79a897e8bf414 (patch) | |
tree | 76a9943bc99865c1214e7cdfe40027cf7559d63f /src/testlib/qtestcase.cpp | |
parent | c7a86c5e0c2c46be0972dac8ed797abbe3ed44ae (diff) |
Use QFileInfo::exists(f) instead of QFileInfo(f).exists()
QFileInfo::exists(f) is somewhat faster than the version which creates an temporary object.
Change-Id: I5f931a86d9dfad57d99efe04ca115422de43def9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r-- | src/testlib/qtestcase.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 286da52be2..36eff6ac98 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -3219,7 +3219,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co QString testsPath = QLibraryInfo::location(QLibraryInfo::TestsPath); QString candidate = QString::fromLatin1("%1/%2/%3") .arg(testsPath, QFile::decodeName(testObjectName).toLower(), base); - if (QFileInfo(candidate).exists()) { + if (QFileInfo::exists(candidate)) { found = candidate; } else if (QTestLog::verboseLevel() >= 2) { @@ -3244,7 +3244,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co } QString candidate = QString::fromLatin1("%1/%2").arg(srcdir.canonicalFilePath(), base); - if (QFileInfo(candidate).exists()) { + if (QFileInfo::exists(candidate)) { found = candidate; } else if (QTestLog::verboseLevel() >= 2) { @@ -3258,21 +3258,21 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co // 4. Try resources if (found.isEmpty()) { QString candidate = QString::fromLatin1(":/%1").arg(base); - if (QFileInfo(candidate).exists()) + if (QFileInfo::exists(candidate)) found = candidate; } // 5. Try current directory if (found.isEmpty()) { QString candidate = QString::fromLatin1("%1/%2").arg(QDir::currentPath()).arg(base); - if (QFileInfo(candidate).exists()) + if (QFileInfo::exists(candidate)) found = candidate; } // 6. Try main source directory if (found.isEmpty()) { QString candidate = QTest::mainSourcePath % QLatin1Char('/') % base; - if (QFileInfo(candidate).exists()) + if (QFileInfo::exists(candidate)) found = candidate; } |