summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2022-12-20 09:23:45 +0200
committerKatja Marttila <katja.marttila@qt.io>2022-12-20 11:39:13 +0000
commitb1b50fcb281efc7681c4520ddf1f19bae11b624c (patch)
tree4faaf13ce454683c987e8a7189b0f1204aefe213 /src/libs
parent2421fb59b341ad60ae28c203769150b20d03934f (diff)
Optimize metadata validation
QFile::open is time consuming operation in Windws. Metadata validation does not need to open the file, it is enough to check that the file exists in the expected location, thus using QFileInfo::exists() instead of QFile::open for metadata validation. Change-Id: Ic1cee9915db2f3359569ad772a4ac619c03f2446 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/installer/metadata.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libs/installer/metadata.cpp b/src/libs/installer/metadata.cpp
index c90937bb8..9ae817127 100644
--- a/src/libs/installer/metadata.cpp
+++ b/src/libs/installer/metadata.cpp
@@ -123,15 +123,14 @@ QDomDocument Metadata::updatesDocument() const
/*!
Returns \c true if the \c Updates.xml document of this metadata
- exists and can be opened for reading, \c false otherwise.
+ exists, \c false otherwise.
*/
bool Metadata::isValid() const
{
- QFile updateFile(path() + QLatin1String("/Updates.xml"));
- if (!updateFile.open(QIODevice::ReadOnly)) {
+ const QString updateFile(path() + QLatin1String("/Updates.xml"));
+ if (!QFileInfo::exists(updateFile)) {
qCWarning(QInstaller::lcInstallerInstallLog)
- << "Cannot open" << updateFile.fileName()
- << "for reading:" << updateFile.errorString();
+ << "File" << updateFile << "does not exist.";
return false;
}
return true;