summaryrefslogtreecommitdiffstats
path: root/logic/net
diff options
context:
space:
mode:
authorAndrew <forkk@forkk.net>2013-12-05 20:32:12 -0600
committerAndrew <forkk@forkk.net>2013-12-05 20:32:52 -0600
commite90f1a27569ac6b9e9782646c9de92fc9534b1d2 (patch)
treed04e408ed599a6f33bdcd341dbc99cb6d1de5cb7 /logic/net
parent48ec8e67b8cff63cd2d0e08c17e7bb576b4e07a7 (diff)
downloadMultiMC-e90f1a27569ac6b9e9782646c9de92fc9534b1d2.tar
MultiMC-e90f1a27569ac6b9e9782646c9de92fc9534b1d2.tar.gz
MultiMC-e90f1a27569ac6b9e9782646c9de92fc9534b1d2.tar.lz
MultiMC-e90f1a27569ac6b9e9782646c9de92fc9534b1d2.tar.xz
MultiMC-e90f1a27569ac6b9e9782646c9de92fc9534b1d2.zip
Implement update installer
Diffstat (limited to 'logic/net')
-rw-r--r--logic/net/FileDownload.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/logic/net/FileDownload.cpp b/logic/net/FileDownload.cpp
index 239af351..38f0b9c2 100644
--- a/logic/net/FileDownload.cpp
+++ b/logic/net/FileDownload.cpp
@@ -63,6 +63,15 @@ void FileDownload::start()
request.setRawHeader(QString("If-None-Match").toLatin1(), m_expected_md5.toLatin1());
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)");
+ // Go ahead and try to open the file.
+ // If we don't do this, empty files won't be created, which breaks the updater.
+ // Plus, this way, we don't end up starting a download for a file we can't open.
+ if (!m_output_file.open(QIODevice::WriteOnly))
+ {
+ emit failed(index_within_job);
+ return;
+ }
+
auto worker = MMC->qnam();
QNetworkReply *rep = worker->get(request);