GH-1060 create and delete update dir
This commit is contained in:
parent
15b7c3039a
commit
88f5c8d347
@ -989,6 +989,10 @@ void MainWindow::downloadUpdates(GoUpdate::Status status)
|
|||||||
status.rootPath = MMC->rootPath;
|
status.rootPath = MMC->rootPath;
|
||||||
|
|
||||||
auto dlPath = PathCombine(MMC->root(), "update", "XXXXXX");
|
auto dlPath = PathCombine(MMC->root(), "update", "XXXXXX");
|
||||||
|
if(!ensureFilePathExists(dlPath))
|
||||||
|
{
|
||||||
|
CustomMessageBox::selectable(this, tr("Error"), tr("Couldn't create folder for update downloads:\n%1").arg(dlPath), QMessageBox::Warning)->show();
|
||||||
|
}
|
||||||
GoUpdate::DownloadTask updateTask(status, dlPath, &updateDlg);
|
GoUpdate::DownloadTask updateTask(status, dlPath, &updateDlg);
|
||||||
// If the task succeeds, install the updates.
|
// If the task succeeds, install the updates.
|
||||||
if (updateDlg.exec(&updateTask))
|
if (updateDlg.exec(&updateTask))
|
||||||
|
@ -663,6 +663,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString backupPath = PathCombine(root(), "update", "backup");
|
QString backupPath = PathCombine(root(), "update", "backup");
|
||||||
|
QDir origin(root());
|
||||||
|
|
||||||
// clean up the backup folder. it should be empty before we start
|
// clean up the backup folder. it should be empty before we start
|
||||||
if(!deletePath(backupPath))
|
if(!deletePath(backupPath))
|
||||||
@ -773,6 +774,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
|
|||||||
failedOperationType = Start;
|
failedOperationType = Start;
|
||||||
goto FAILED;
|
goto FAILED;
|
||||||
}
|
}
|
||||||
|
origin.rmdir(updateFilesDir);
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user