Changed: Use a temporary file to check if we're uninstalling old client, see #279

This commit is contained in:
kervala 2016-09-20 18:34:59 +02:00
parent 518a2e0e32
commit 71f0195664
2 changed files with 21 additions and 6 deletions

View file

@ -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;
}

View file

@ -152,7 +152,6 @@ private:
QString m_srcDirectory;
bool m_use64BitsClient;
bool m_shouldUninstallOldClient;
bool m_uninstallingOldClient;
QString m_language;
QString m_defaultConfigPath;