diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index fea558af4..10ea322a2 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -466,7 +466,7 @@ bool CConfigFile::uninstallingOldClient() const return QFile::exists(getInstallationDirectory() + "/ryzom_installer_uninstalling_old_client"); } -void CConfigFile::setUninstallingOldClient(bool on) +void CConfigFile::setUninstallingOldClient(bool on) const { QString filename = getInstallationDirectory() + "/ryzom_installer_uninstalling_old_client"; @@ -999,9 +999,19 @@ OperationStep CConfigFile::getInstallNextStep() const if (!settings.contains("InstallLocation")) return CreateAddRemoveEntry; #endif - if (!uninstallingOldClient() && m_shouldUninstallOldClient && !getSrcServerDirectory().isEmpty() && QFile::exists(getSrcServerDirectory() + "/Uninstall.exe")) + if (m_shouldUninstallOldClient && !getSrcServerDirectory().isEmpty()) { - return UninstallOldClient; + // if old client must be uninstalled + if (!uninstallingOldClient() && QFile::exists(getSrcServerDirectory() + "/Uninstall.exe")) + { + return UninstallOldClient; + } + + // if old client has been uninstalled + if (uninstallingOldClient() && !QFile::exists(getSrcServerDirectory() + "/Uninstall.exe")) + { + setUninstallingOldClient(false); + } } return Done; diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index ecad07af3..70ca6a6a0 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -112,7 +112,7 @@ public: void setShouldUninstallOldClient(bool on); bool uninstallingOldClient() const; - void setUninstallingOldClient(bool on); + void setUninstallingOldClient(bool on) const; QString expandVariables(const QString &str) const; diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index 3902296ec..c20b40efe 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -80,26 +80,6 @@ bool copyInstallerFiles(const QStringList &files, const QString &destination) return true; } -#ifdef Q_OS_WIN -class CCOMHelper -{ - bool m_mustUninit; - -public: - CCOMHelper() - { - // to fix the bug with QFileDialog::getExistingDirectory hanging under Windows - m_mustUninit = SUCCEEDED(CoInitialize(NULL)); - } - - ~CCOMHelper() - { - // only call CoUninitialize if CoInitialize succeeded - if (m_mustUninit) CoUninitialize(); - } -}; -#endif - int main(int argc, char *argv[]) { #if defined(_MSC_VER) && defined(_DEBUG) diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp index 28860ffab..e2b26a7bb 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp @@ -31,7 +31,7 @@ QString qBytesToHumanReadable(qint64 bytes) units.push_back(QObject::tr("PiB").toUtf8().constData()); } - return QString::fromUtf8(NLMISC::bytesToHumanReadable(bytes).c_str()); + return QString::fromUtf8(NLMISC::bytesToHumanReadableUnits(bytes, units).c_str()); } qint64 getDirectorySize(const QString &directory, bool recursize) @@ -99,6 +99,8 @@ wchar_t* qToWide(const QString &str) bool createLink(const QString &link, const QString &name, const QString &executable, const QString &arguments, const QString &icon, const QString &workingDir) { + CCOMHelper comHelper; + IShellLinkW* psl; // Get a pointer to the IShellLink interface. It is assumed that CoInitialize @@ -135,6 +137,8 @@ bool createLink(const QString &link, const QString &name, const QString &executa bool resolveLink(const QWidget &window, const QString &linkFile, QString &path) { + CCOMHelper comHelper; + IShellLinkW* psl; WIN32_FIND_DATAW wfd; @@ -239,3 +243,21 @@ bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathOb } #endif + +CCOMHelper::CCOMHelper() +{ +#ifdef Q_OS_WIN + // to fix the bug with QFileDialog::getExistingDirectory hanging under Windows + m_mustUninit = SUCCEEDED(CoInitialize(NULL)); +#else + m_mustUninit = false; +#endif +} + +CCOMHelper::~CCOMHelper() +{ +#ifdef Q_OS_WIN + // only call CoUninitialize if CoInitialize succeeded + if (m_mustUninit) CoUninitialize(); +#endif +} diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.h b/code/ryzom/tools/client/ryzom_installer/src/utils.h index 6de89bcba..c016ed8ba 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.h +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.h @@ -51,4 +51,13 @@ wchar_t* qToWide(const QString &str); bool createLink(const QString &link, const QString &name, const QString &executable, const QString &arguments, const QString &icon, const QString &workingDir); bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathObj); +class CCOMHelper +{ + bool m_mustUninit; + +public: + CCOMHelper(); + ~CCOMHelper(); +}; + #endif diff --git a/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_fr.ts b/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_fr.ts index 705b70452..0a42d8362 100644 --- a/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_fr.ts +++ b/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_fr.ts @@ -559,9 +559,9 @@ This program will migrate Ryzom version 2.1 to 3.0. Your files will be updated, Just press Continue button and follow the different steps until everything is done. Bienvenue dans l'Installateur de Ryzom ! -Ce programme vous permettra de télécharger, installer, configurer et gérer Ryzom sur votre ordinateur. +Ce programme vous permettra de migrer Ryzom de la version 2.1 à 3.0. Vos fichiers seront mis à jour, nettoyés et déplacés vers un nouvel emplacement. -Vous n'avez qu'à suivre les différentes étapes et faire un choix entre les différentes options proposées. +Vous n'avez qu'à cliquer sur Suivant et suivre les différentes étapes jusqu'à la fin.