diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-01-26 12:06:40 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-01-27 05:06:51 +0000 |
commit | 97b448b152f0148adb2426c2a4e1f83dd150db3c (patch) | |
tree | b2e5b2676683cab3f456cd8e1ffc7e56c4a814c7 | |
parent | c195fde37a533956073000590b3bf66cb91e6bc3 (diff) |
Use QFile::exists(f) instead of QFile(f).exists().
It's faster.
Change-Id: Ie57619b4e0c53975aa955c83c833c34e1446e4c8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rw-r--r-- | src/corelib/io/qfile.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index ce1684a943..4474fd3f52 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -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(). diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index 4126456f90..44f1d7e6ba 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -273,7 +273,7 @@ QString TableGenerator::findComposeFile() // check if user’s 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; |