From de1b1e67fa2a223b06a1ce28e0fba264733be9c3 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 18 Oct 2016 13:42:19 +0200 Subject: [PATCH] Fixed: Restart Installer at the end of installation/migration --- .../client/ryzom_installer/src/configfile.cpp | 49 ++++++++++--------- .../tools/client/ryzom_installer/src/main.cpp | 15 ++++-- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index babad9397..08b485773 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -974,29 +974,7 @@ OperationStep CConfigFile::getInstallNextStep() const } // current installer more recent than installed one - switch (compareInstallersVersion()) - { - // current installer more recent, copy it - case 1: return CopyInstaller; - - // current installer older, launch the more recent installer - case -1: return LaunchInstalledInstaller; - - // continue only if 0 and launched Installer is the installed one - default: - { -#ifdef Q_OS_WIN32 - QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); - - // check if launched from TEMP directory - bool rightPath = getInstallerCurrentDirPath().startsWith(tempPath); -#else - bool rightPath = false; -#endif - - if (!rightPath && getInstallerCurrentFilePath() != getInstallerInstalledFilePath() && QFile::exists(getInstallerInstalledFilePath())) return LaunchInstalledInstaller; - } - } + if (compareInstallersVersion() == 1) return CopyInstaller; // no default profile if (profile.id.isEmpty()) @@ -1039,6 +1017,31 @@ OperationStep CConfigFile::getInstallNextStep() const } } + // current installer more recent than installed one + switch (compareInstallersVersion()) + { + // current installer more recent, copy it + case 1: break; + + // current installer older, launch the more recent installer + case -1: return LaunchInstalledInstaller; + + // continue only if 0 and launched Installer is the installed one + default: + { +#ifdef Q_OS_WIN32 + QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); + + // check if launched from TEMP directory + bool rightPath = getInstallerCurrentDirPath().startsWith(tempPath); +#else + bool rightPath = false; +#endif + + if (!rightPath && getInstallerCurrentFilePath() != getInstallerInstalledFilePath() && QFile::exists(getInstallerInstalledFilePath())) return LaunchInstalledInstaller; + } + } + return Done; } diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index 4982fcad8..6b664ace0 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -241,6 +241,8 @@ int main(int argc, char *argv[]) step = config.getInstallNextStep(); } + + bool restartInstaller = false; if (step != Done) { @@ -254,20 +256,25 @@ int main(int argc, char *argv[]) if (step == LaunchInstalledInstaller) { -#ifndef _DEBUG // restart more recent installed Installer version - if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0; -#endif + restartInstaller = true; } else if (step == Done) { #if defined(Q_OS_WIN) && !defined(_DEBUG) // restart Installer, so it could be copied in TEMP and allowed to update itself - if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0; + restartInstaller = true; #endif } } + if (restartInstaller) + { +#ifndef _DEBUG + if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0; +#endif + } + CMainWindow mainWindow; mainWindow.show();