diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-12-07 03:57:40 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-12-07 03:57:40 +0100 |
commit | 220e07aef4a34dca9f31ae0c5bb994e5c594125d (patch) | |
tree | 70821c6dbe7e6c2f66f231dcb1bad62a763638d7 /logic/net/FileDownload.cpp | |
parent | 858916b951e92127c22503826b746d1e70c433f6 (diff) | |
parent | 7a6705030c36b2d6b94da1acd5bdf2311e4efeb7 (diff) | |
download | MultiMC-220e07aef4a34dca9f31ae0c5bb994e5c594125d.tar MultiMC-220e07aef4a34dca9f31ae0c5bb994e5c594125d.tar.gz MultiMC-220e07aef4a34dca9f31ae0c5bb994e5c594125d.tar.lz MultiMC-220e07aef4a34dca9f31ae0c5bb994e5c594125d.tar.xz MultiMC-220e07aef4a34dca9f31ae0c5bb994e5c594125d.zip |
Merge branch 'feature_updater' of github.com:MultiMC/MultiMC5 into feature_updater
Diffstat (limited to 'logic/net/FileDownload.cpp')
-rw-r--r-- | logic/net/FileDownload.cpp | 9 |
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); |