diff options
-rw-r--r-- | gui/MainWindow.cpp | 14 | ||||
-rw-r--r-- | logic/updater/DownloadUpdateTask.cpp | 13 |
2 files changed, 14 insertions, 13 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 006f5b8e..bafccb1b 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -248,8 +248,14 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi // set up the updater object. auto updater = MMC->updateChecker(); - QObject::connect(updater.get(), &UpdateChecker::updateAvailable, this, - &MainWindow::updateAvailable); + connect(updater.get(), &UpdateChecker::updateAvailable, this, + &MainWindow::updateAvailable); + connect(updater.get(), &UpdateChecker::noUpdateFound, [this]() + { + CustomMessageBox::selectable( + this, tr("No update found."), + tr("No MultiMC update was found!\nYou are using the latest version."))->exec(); + }); // if automatic update checks are allowed, start one. if (MMC->settings()->get("AutoUpdate").toBool()) on_actionCheckUpdate_triggered(); @@ -681,9 +687,7 @@ void MainWindow::on_actionConfig_Folder_triggered() void MainWindow::on_actionCheckUpdate_triggered() { auto updater = MMC->updateChecker(); - connect(updater.get(), &UpdateChecker::noUpdateFound, [this](){ - CustomMessageBox::selectable(this, "No update found.", "No MultiMC update was found!\nYou are using the latest version.")->exec(); - }); + updater->checkForUpdate(true); } diff --git a/logic/updater/DownloadUpdateTask.cpp b/logic/updater/DownloadUpdateTask.cpp index 5f05b0ba..057ca436 100644 --- a/logic/updater/DownloadUpdateTask.cpp +++ b/logic/updater/DownloadUpdateTask.cpp @@ -438,9 +438,6 @@ bool DownloadUpdateTask::writeInstallScript(UpdateOperationList &opsList, QStrin { QDomElement file = doc.createElement("file"); - QString native_file = QDir::toNativeSeparators(op.file); - QString native_dest = QDir::toNativeSeparators(op.dest); - switch (op.type) { case UpdateOperation::OP_COPY: @@ -449,8 +446,8 @@ bool DownloadUpdateTask::writeInstallScript(UpdateOperationList &opsList, QStrin QDomElement name = doc.createElement("source"); QDomElement path = doc.createElement("dest"); QDomElement mode = doc.createElement("mode"); - name.appendChild(doc.createTextNode(native_file)); - path.appendChild(doc.createTextNode(native_dest)); + name.appendChild(doc.createTextNode(op.file)); + path.appendChild(doc.createTextNode(op.dest)); // We need to add a 0 at the beginning here, because Qt doesn't convert to octal // correctly. mode.appendChild(doc.createTextNode("0" + QString::number(op.mode, 8))); @@ -458,16 +455,16 @@ bool DownloadUpdateTask::writeInstallScript(UpdateOperationList &opsList, QStrin file.appendChild(path); file.appendChild(mode); installFiles.appendChild(file); - QLOG_DEBUG() << "Will install file" << native_file; + QLOG_DEBUG() << "Will install file " << op.file << " to " << op.dest; } break; case UpdateOperation::OP_DELETE: { // Delete the file. - file.appendChild(doc.createTextNode(native_file)); + file.appendChild(doc.createTextNode(op.file)); removeFiles.appendChild(file); - QLOG_DEBUG() << "Will remove file" << native_file; + QLOG_DEBUG() << "Will remove file" << op.file; } break; |