Skip to content

Commit

Permalink
GH-1060 create and delete update dir
Browse files Browse the repository at this point in the history
  • Loading branch information
peterix committed Jun 9, 2015
1 parent 15b7c30 commit 88f5c8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions application/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,10 @@ void MainWindow::downloadUpdates(GoUpdate::Status status)
status.rootPath = MMC->rootPath;

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);
// If the task succeeds, install the updates.
if (updateDlg.exec(&updateTask))
Expand Down
2 changes: 2 additions & 0 deletions application/MultiMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
#endif

QString backupPath = PathCombine(root(), "update", "backup");
QDir origin(root());

// clean up the backup folder. it should be empty before we start
if(!deletePath(backupPath))
Expand Down Expand Up @@ -773,6 +774,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
failedOperationType = Start;
goto FAILED;
}
origin.rmdir(updateFilesDir);
qApp->quit();
return;

Expand Down

0 comments on commit 88f5c8d

Please sign in to comment.