forked from qt-creator/qt-creator
Replace QFile::exists by QFileInfo::exists
QFile::exists only calls QFileInfo::exists, so this saves one function call per invocation. Change-Id: I41cb407345654eeead14455a4955b8b9b015aedc Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -957,7 +957,7 @@ void SplitterOrView::restoreState(const QByteArray &state)
|
||||
stream >> historyData;
|
||||
view()->m_editorHistory = loadHistory(historyData);
|
||||
|
||||
if (!QFile::exists(fileName))
|
||||
if (!QFileInfo::exists(fileName))
|
||||
return;
|
||||
IEditor *e = EditorManagerPrivate::openEditor(view(), FilePath::fromString(fileName), Id::fromString(id),
|
||||
EditorManager::IgnoreNavigationHistory
|
||||
|
||||
@@ -174,7 +174,7 @@ static bool hasQmFilesForLocale(const QString &locale, const QString &creatorTrP
|
||||
static const QString qtTrPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||
|
||||
const QString trFile = QLatin1String("/qt_") + locale + QLatin1String(".qm");
|
||||
return QFile::exists(qtTrPath + trFile) || QFile::exists(creatorTrPath + trFile);
|
||||
return QFileInfo::exists(qtTrPath + trFile) || QFileInfo::exists(creatorTrPath + trFile);
|
||||
}
|
||||
|
||||
void GeneralSettingsWidget::fillLanguageBox() const
|
||||
|
||||
@@ -633,7 +633,7 @@ void MimeTypeSettingsPrivate::writeUserModifiedMimeTypes()
|
||||
{
|
||||
static Utils::FilePath modifiedMimeTypesFile = ICore::userResourcePath(kModifiedMimeTypesFile);
|
||||
|
||||
if (QFile::exists(modifiedMimeTypesFile.toString())
|
||||
if (QFileInfo::exists(modifiedMimeTypesFile.toString())
|
||||
|| QDir().mkpath(modifiedMimeTypesFile.parentDir().toString())) {
|
||||
QFile file(modifiedMimeTypesFile.toString());
|
||||
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
bool isComplete() const final
|
||||
{
|
||||
const FilePath path = m_data->sourcePath;
|
||||
if (!QFile::exists(path.toString())) {
|
||||
if (!QFileInfo::exists(path.toString())) {
|
||||
m_info->setText(Tr::tr("File does not exist."));
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user