summaryrefslogtreecommitdiffstats
path: root/src/libs/kdtools/filedownloader.cpp
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2018-05-09 13:05:45 +0300
committerKatja Marttila <katja.marttila@qt.io>2018-06-01 05:06:48 +0000
commit85bff5f7b8c5958277f3b763ec6dba4bd8ec94c4 (patch)
tree6162468a6cbb334fc29b97dc5371d2a59068fe0d /src/libs/kdtools/filedownloader.cpp
parentd5be955bbb6cf595f7f6c30c4b1904c153a4d7c7 (diff)
Decrease metadata dowload amount
If there are no Script, Translations, Licenses nor UserInterfaces -tags in Updates.xml, there is no metadata. In such case, do not download the empty metadata to decrease the time used in downloading metadata. Task-number: QTIFW-975 Change-Id: I1b81a07b5ad43677e190fb058ece8b06382d215b Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src/libs/kdtools/filedownloader.cpp')
-rw-r--r--src/libs/kdtools/filedownloader.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libs/kdtools/filedownloader.cpp b/src/libs/kdtools/filedownloader.cpp
index 8032bbe22..5574a3af6 100644
--- a/src/libs/kdtools/filedownloader.cpp
+++ b/src/libs/kdtools/filedownloader.cpp
@@ -660,6 +660,17 @@ void KDUpdater::FileDownloader::resetCheckSumData()
d->m_hash.reset();
}
+/*!
+ Creates a directory structure for \a fileName if it does not exist.
+*/
+void KDUpdater::FileDownloader::createDirectoryForFile(const QString fileName)
+{
+ QFileInfo fileInfo(fileName);
+ if (!fileInfo.absoluteDir().exists()) {
+ QDir filePath = fileInfo.absoluteDir();
+ filePath.mkdir(filePath.absolutePath());
+ }
+}
/*!
Returns a copy of the proxy factory that this FileDownloader object is using to determine the
@@ -814,6 +825,7 @@ void KDUpdater::LocalFileDownloader::doDownload()
file->open();
d->destination = file;
} else {
+ createDirectoryForFile(d->destFileName);
d->destination = new QFile(d->destFileName, this);
d->destination->open(QIODevice::ReadWrite | QIODevice::Truncate);
}
@@ -1466,6 +1478,7 @@ void KDUpdater::HttpDownloader::startDownload(const QUrl &url)
file->open();
d->destination = file;
} else {
+ createDirectoryForFile(d->destFileName);
d->destination = new QFile(d->destFileName, this);
d->destination->open(QIODevice::ReadWrite | QIODevice::Truncate);
}