]> git.sur5r.net Git - minitube/blob - lib/updater/src/impl/runinstaller.cpp
New upstream version 3.5
[minitube] / lib / updater / src / impl / runinstaller.cpp
1 #include "runinstaller.h"
2
3 #include <QDesktopServices>
4
5 namespace updater {
6
7 RunInstaller::RunInstaller() : Installer() {}
8
9 void RunInstaller::start(const QString &filename) {
10     if (arguments.isEmpty()) {
11         if (!QDesktopServices::openUrl(QUrl("file:///" + filename)))
12             emit error("Cannot start update");
13     } else {
14         QProcess *process = new QProcess(this);
15         QObject::connect(process, &QProcess::errorOccurred, this, [this](auto error) {
16             this->emit error("Update error: " + QVariant::fromValue(error).toString());
17         });
18         process->startDetached(filename, arguments);
19     }
20 }
21
22 } // namespace updater