summaryrefslogtreecommitdiff
path: root/src/selfupdater.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-03-29 10:12:34 +0100
committerTannin <devnull@localhost>2013-03-29 10:12:34 +0100
commita47d9717884953b18b4b29e596d3e5a7d766e56e (patch)
tree565a3f1371ff9727d31d01590f105496294570d3 /src/selfupdater.cpp
parent10485e15e4de3e1a6c30733ad2d4850591d31509 (diff)
parent59d6b7840b1e7fdbb7475010273047b7bb185d3a (diff)
Merge with default
Diffstat (limited to 'src/selfupdater.cpp')
-rw-r--r--src/selfupdater.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp
index 503c2596..78c7dea7 100644
--- a/src/selfupdater.cpp
+++ b/src/selfupdater.cpp
@@ -90,10 +90,10 @@ SelfUpdater::~SelfUpdater()
void SelfUpdater::testForUpdate()
{
-/* if (QFile::exists(QCoreApplication::applicationDirPath() + "/mo_test_update.7z")) {
+ if (QFile::exists(QCoreApplication::applicationDirPath() + "/mo_test_update.7z")) {
emit updateAvailable();
return;
- }*/
+ }
if (m_UpdateRequestID == -1) {
m_UpdateRequestID = m_Interface->requestDescription(
@@ -104,11 +104,11 @@ void SelfUpdater::testForUpdate()
void SelfUpdater::startUpdate()
{
-/* if (QFile::exists(QCoreApplication::applicationDirPath() + "/mo_test_update.7z")) {
+ if (QFile::exists(QCoreApplication::applicationDirPath() + "/mo_test_update.7z")) {
m_UpdateFile.setFileName(QCoreApplication::applicationDirPath() + "/mo_test_update.7z");
installUpdate();
return;
- }*/
+ }
if ((m_UpdateRequestID == -1) &&
(!m_NewestVersion.isEmpty())) {
@@ -243,9 +243,13 @@ void SelfUpdater::installUpdate()
} else if (outputName == "ModOrganizer") {
data[i]->setSkip(true);
}
- QFile file(mopath.mid(0).append("/").append(outputName));
- if (file.exists()) {
- file.rename(backupPath.mid(0).append("/").append(outputName));
+ QFileInfo file(mopath.mid(0).append("/").append(outputName));
+ if (file.exists() && file.isFile()) {
+ if (!shellMove(QStringList(mopath.mid(0).append("/").append(outputName)),
+ QStringList(backupPath.mid(0).append("/").append(outputName)))) {
+ reportError(tr("failed to move outdated files: %1. Please update manually.").arg(windowsErrorString(::GetLastError())));
+ return;
+ }
}
}