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>
This commit is contained in:
parent
c7a86c5e0c
commit
a01146aac1
@ -1334,7 +1334,7 @@ void VcprojGenerator::initDeploymentTool()
|
||||
if (!vcInstallDir.isEmpty()) {
|
||||
vcInstallDir += "\\ce\\dll\\";
|
||||
vcInstallDir += project->values("CE_ARCH").join(QLatin1Char(' '));
|
||||
if (!QFileInfo(vcInstallDir + QDir::separator() + runtimeVersion).exists())
|
||||
if (!QFileInfo::exists(vcInstallDir + QDir::separator() + runtimeVersion))
|
||||
runtime.clear();
|
||||
else
|
||||
runtime = vcInstallDir;
|
||||
|
@ -195,7 +195,7 @@ QJsonObject AndroidStyle::loadStyleData()
|
||||
}
|
||||
Q_ASSERT(!stylePath.isEmpty());
|
||||
|
||||
if (!androidTheme.isEmpty() && QFileInfo(stylePath + androidTheme + QLatin1String("style.json")).exists())
|
||||
if (!androidTheme.isEmpty() && QFileInfo::exists(stylePath + androidTheme + QLatin1String("style.json")))
|
||||
stylePath += androidTheme;
|
||||
|
||||
QFile f(stylePath + QLatin1String("style.json"));
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -862,7 +862,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
|
||||
#endif
|
||||
|
||||
QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
|
||||
if ((pathElements.isEmpty() || !QFileInfo(path).exists())
|
||||
if ((pathElements.isEmpty() || !QFileInfo::exists(path))
|
||||
#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
|
||||
&& path != QLatin1String("/")
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user