Use QFile::exists(f) instead of QFile(f).exists().

It's faster.

Change-Id: Ie57619b4e0c53975aa955c83c833c34e1446e4c8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
bb10
Anton Kudryavtsev 2016-01-26 12:06:40 +03:00
parent c195fde37a
commit 97b448b152
2 changed files with 4 additions and 4 deletions

View File

@ -747,7 +747,7 @@ QFile::copy(const QString &newName)
qWarning("QFile::copy: Empty or null file name");
return false;
}
if (QFile(newName).exists()) {
if (QFile::exists(newName)) {
// ### Race condition. If a file is moved in after this, it /will/ be
// overwritten. On Unix, the proper solution is to use hardlinks:
// return ::link(old, new) && ::remove(old); See also rename().

View File

@ -273,7 +273,7 @@ QString TableGenerator::findComposeFile()
// check if users home directory has a file named .XCompose
if (cleanState()) {
QString path = qgetenv("HOME") + QStringLiteral("/.XCompose");
if (QFile(path).exists())
if (QFile::exists(path))
return path;
}
@ -286,7 +286,7 @@ QString TableGenerator::findComposeFile()
m_state = UnsupportedLocale;
else {
QString path = QDir(systemComposeDir()).filePath(table);
if (QFile(path).exists())
if (QFile::exists(path))
return path;
}
}
@ -308,7 +308,7 @@ bool TableGenerator::findSystemComposeDir()
bool found = false;
for (int i = 0; i < m_possibleLocations.size(); ++i) {
QString path = m_possibleLocations.at(i);
if (QFile(path + QLatin1String("/compose.dir")).exists()) {
if (QFile::exists(path + QLatin1String("/compose.dir"))) {
m_systemComposeDir = path;
found = true;
break;