summaryrefslogtreecommitdiff
path: root/src/selfupdater.cpp
diff options
context:
space:
mode:
authorAl <gabriel.cortesi@outlook.com>2019-05-26 12:24:02 +0200
committerGitHub <noreply@github.com>2019-05-26 12:24:02 +0200
commit2caa688e5581849441b1c96e4a2d357e9241f74a (patch)
treec99b83f84f4be692663be4256e9ec955f4258e7e /src/selfupdater.cpp
parent2d58ad346c9e8840d3864080d62999e686962a76 (diff)
parent21185182c6551d053cccdcf087e0c219a3785cf8 (diff)
Merge pull request #731 from isanae/filetree-dds-preview-630
Add preview to filetree, some refactoring
Diffstat (limited to 'src/selfupdater.cpp')
-rw-r--r--src/selfupdater.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp
index 4c0f9a8d..271c621b 100644
--- a/src/selfupdater.cpp
+++ b/src/selfupdater.cpp
@@ -31,6 +31,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "settings.h"
#include "bbcode.h"
#include "plugincontainer.h"
+#include "organizercore.h"
#include <versioninfo.h>
#include <report.h>
#include <util.h>
@@ -178,7 +179,7 @@ void SelfUpdater::startUpdate()
tr("New update available (%1)")
.arg(m_UpdateCandidate["tag_name"].toString()), tr("Do you want to install update? All your mods and setup will be left untouched.\nSelect Show Details option to see the full change-log."),
QMessageBox::Yes | QMessageBox::Cancel, m_Parent);
-
+
query.setDetailedText(m_UpdateCandidate["body"].toString());
query.button(QMessageBox::Yes)->setText(tr("Install"));
@@ -329,22 +330,14 @@ void SelfUpdater::downloadCancel()
void SelfUpdater::installUpdate()
{
- const QString mopath
- = QDir::fromNativeSeparators(qApp->property("dataPath").toString());
-
- std::wstring parameters = ToWString("/DIR=\"" + qApp->applicationDirPath() + "\" ");
+ const QString parameters = "/DIR=\"" + qApp->applicationDirPath() + "\" ";
- HINSTANCE res = ::ShellExecuteW(
- nullptr, L"open", m_UpdateFile.fileName().toStdWString().c_str(), parameters.c_str(),
- nullptr, SW_SHOW);
-
- if (res > (HINSTANCE)32) {
+ if (shell::Execute(m_UpdateFile.fileName(), parameters)) {
QCoreApplication::quit();
} else {
- reportError(tr("Failed to start %1: %2")
- .arg(m_UpdateFile.fileName())
- .arg((INT_PTR)res));
+ reportError(tr("Failed to start %1").arg(m_UpdateFile.fileName()));
}
+
m_UpdateFile.remove();
}