GH-1206 fix deleting files during update

Backups weren't created properly which led to failure to update
This commit is contained in:
Petr Mrázek 2015-08-23 22:33:59 +02:00
parent 0d15247247
commit 961c1c61b8

View File

@ -782,10 +782,13 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
// delete = move original to backup
case GoUpdate::Operation::OP_DELETE:
{
QString trashFilePath = PathCombine(backupPath, op.file);
QString origFilePath = PathCombine(root(), op.file);
if(QFile::exists(origFilePath))
{
QString backupName = op.file;
backupName.replace('/', '_');
QString trashFilePath = PathCombine(backupPath, backupName);
if(!QFile::rename(origFilePath, trashFilePath))
{
qWarning() << "DELETE: Couldn't move:" << op.file << "to" << trashFilePath;