From 2c6719b8c8a66038166ccfb9e07f9f04f4140bac Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 20 Sep 2016 18:34:59 +0200 Subject: [PATCH] Changed: Use a temporary file to check if we're uninstalling old client, see #279 --- .../client/ryzom_installer/src/configfile.cpp | 26 +++++++++++++++---- .../client/ryzom_installer/src/configfile.h | 1 - 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index f23976cd9..fea558af4 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -27,8 +27,7 @@ CConfigFile *CConfigFile::s_instance = NULL; CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_version(-1), - m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true), - m_uninstallingOldClient(false) + m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true) { s_instance = this; @@ -464,12 +463,29 @@ void CConfigFile::setShouldUninstallOldClient(bool on) bool CConfigFile::uninstallingOldClient() const { - return m_uninstallingOldClient; + return QFile::exists(getInstallationDirectory() + "/ryzom_installer_uninstalling_old_client"); } void CConfigFile::setUninstallingOldClient(bool on) { - m_uninstallingOldClient = on; + QString filename = getInstallationDirectory() + "/ryzom_installer_uninstalling_old_client"; + + if (on) + { + // writing a file to avoid asking several times when relaunching installer + QFile file(filename); + + if (file.open(QFile::WriteOnly)) + { + file.write("empty"); + file.close(); + } + } + else + { + // deleting the temporary file + if (QFile::exists(filename)) QFile::remove(filename); + } } QString CConfigFile::expandVariables(const QString &str) const @@ -983,7 +999,7 @@ OperationStep CConfigFile::getInstallNextStep() const if (!settings.contains("InstallLocation")) return CreateAddRemoveEntry; #endif - if (!m_uninstallingOldClient && m_shouldUninstallOldClient && !getSrcServerDirectory().isEmpty() && QFile::exists(getSrcServerDirectory() + "/Uninstall.exe")) + if (!uninstallingOldClient() && m_shouldUninstallOldClient && !getSrcServerDirectory().isEmpty() && QFile::exists(getSrcServerDirectory() + "/Uninstall.exe")) { return UninstallOldClient; } diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index 998565dda..ecad07af3 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -152,7 +152,6 @@ private: QString m_srcDirectory; bool m_use64BitsClient; bool m_shouldUninstallOldClient; - bool m_uninstallingOldClient; QString m_language; QString m_defaultConfigPath;