So I have changed QTextStream to file.write(http->readAll()) but still after download is compile I'm not able to open the archive (Archive is corrupt~.).
Here's my current code:
void Updater::finishDownload()
{
QFile file("Launcher.tmp");
if( file.exists() )
file.remove();
QMessageBox::critical(this,
"Updater",
"Failed to open file.");
return;
}
file.write(http->readAll());
file.close();
proc.start("7z.exe", params);
//file->remove();
updateCurrentVersion();
QMessageBox::information(this,
"Updater",
"New version has been downloaded.");
_parent->show();
close();
}
void Updater::finishDownload()
{
QFile file("Launcher.tmp");
if( file.exists() )
file.remove();
if( !file.open(QIODevice::WriteOnly | QIODevice::Text) ) {
QMessageBox::critical(this, "Updater", "Failed to open file.");
return;
}
file.write(http->readAll());
file.close();
QProcess proc;
proc.start("7z.exe", params);
//file->remove();
updateCurrentVersion();
QMessageBox::information(this, "Updater", "New version has been downloaded.");
_parent->show();
close();
}
To copy to clipboard, switch view to plain text mode
Any other tips?
@Edit:
Oh, dumb me. QIODevice::Text as you said, of course. Problem solved, thanks Chris.
Bookmarks