GH-1206 fix deleting files during update
Backups weren't created properly which led to failure to update
This commit is contained in:
parent
0d15247247
commit
961c1c61b8
@ -782,10 +782,13 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
|
|||||||
// delete = move original to backup
|
// delete = move original to backup
|
||||||
case GoUpdate::Operation::OP_DELETE:
|
case GoUpdate::Operation::OP_DELETE:
|
||||||
{
|
{
|
||||||
QString trashFilePath = PathCombine(backupPath, op.file);
|
|
||||||
QString origFilePath = PathCombine(root(), op.file);
|
QString origFilePath = PathCombine(root(), op.file);
|
||||||
if(QFile::exists(origFilePath))
|
if(QFile::exists(origFilePath))
|
||||||
{
|
{
|
||||||
|
QString backupName = op.file;
|
||||||
|
backupName.replace('/', '_');
|
||||||
|
QString trashFilePath = PathCombine(backupPath, backupName);
|
||||||
|
|
||||||
if(!QFile::rename(origFilePath, trashFilePath))
|
if(!QFile::rename(origFilePath, trashFilePath))
|
||||||
{
|
{
|
||||||
qWarning() << "DELETE: Couldn't move:" << op.file << "to" << trashFilePath;
|
qWarning() << "DELETE: Couldn't move:" << op.file << "to" << trashFilePath;
|
||||||
|
Loading…
Reference in New Issue
Block a user