More update file stuff

This commit is contained in:
Mark Watkins 2011-12-17 22:10:09 +10:00
parent be9748fd10
commit 5f42470c44

View File

@ -374,12 +374,14 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply)
} while (!line.isNull()); } while (!line.isNull());
} else { } else {
QString fn=files.at(i).section("/",-1); QString fn=files.at(i).section("/",-1);
// delete backups
if (f.exists(backups+fn)) f.remove(backups+fn); if (f.exists(backups+fn)) f.remove(backups+fn);
// rename (move) current file to backup
if (!f.rename(apppath+fn,backups+fn)) { if (!f.rename(apppath+fn,backups+fn)) {
errors++; errors++;
} }
//Save zip data as new file
f.setFileName(path); f.setFileName(apppath+fn);
f.open(QFile::WriteOnly); f.open(QFile::WriteOnly);
f.write(ba); f.write(ba);
f.close(); f.close();