Changed: Use getInstallerInstalledFilePath() to get installed Installer full path

This commit is contained in:
kervala 2016-10-16 17:26:05 +02:00
parent 7a61907a41
commit a2f67bf469
3 changed files with 42 additions and 48 deletions

View file

@ -756,12 +756,15 @@ QString CConfigFile::getInstallerCurrentDirPath() const
return QApplication::applicationDirPath(); return QApplication::applicationDirPath();
} }
QString CConfigFile::getInstallerOriginalFilePath() const QString CConfigFile::getInstallerInstalledFilePath() const
{ {
return getInstallerOriginalDirPath() + "/" + QFileInfo(QApplication::applicationFilePath()).fileName(); // return an empty string, if no Installer filename in config
if (m_installerFilename.isEmpty()) return "";
return getInstallerInstalledDirPath() + "/" + m_installerFilename;
} }
QString CConfigFile::getInstallerOriginalDirPath() const QString CConfigFile::getInstallerInstalledDirPath() const
{ {
return m_installationDirectory; return m_installationDirectory;
} }

View file

@ -124,8 +124,8 @@ public:
QString getInstallerCurrentFilePath() const; QString getInstallerCurrentFilePath() const;
QString getInstallerCurrentDirPath() const; QString getInstallerCurrentDirPath() const;
QString getInstallerOriginalFilePath() const; QString getInstallerInstalledFilePath() const;
QString getInstallerOriginalDirPath() const; QString getInstallerInstalledDirPath() const;
QString getInstallerMenuShortcutFullPath() const; QString getInstallerMenuShortcutFullPath() const;
QString getInstallerDesktopShortcutFullPath() const; QString getInstallerDesktopShortcutFullPath() const;

View file

@ -727,13 +727,12 @@ void COperationDialog::copyInstaller()
QString destinationDirectory = config->getInstallationDirectory(); QString destinationDirectory = config->getInstallationDirectory();
// rename old client to installer // rename old client to installer
QString newInstallerFilename = config->getInstallerFilename();
if (!newInstallerFilename.isEmpty())
{
QString oldInstallerFullPath = QApplication::applicationFilePath(); QString oldInstallerFullPath = QApplication::applicationFilePath();
QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename; QString newInstallerFullPath = config->getInstallerInstalledFilePath();
if (!newInstallerFullPath.isEmpty())
{
// always copy new installers // always copy new installers
CFilesCopier copier(this); CFilesCopier copier(this);
copier.setIncludeFilter(config->getInstallerRequiredFiles()); copier.setIncludeFilter(config->getInstallerRequiredFiles());
@ -931,13 +930,9 @@ bool COperationDialog::createAddRemoveEntry()
{ {
CConfigFile *config = CConfigFile::getInstance(); CConfigFile *config = CConfigFile::getInstance();
QString newInstallerFilename = config->getInstallerFilename(); QString newInstallerFullPath = config->getInstallerInstalledFilePath();
if (!newInstallerFilename.isEmpty()) if (!newInstallerFullPath.isEmpty() && QFile::exists(newInstallerFullPath))
{
QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename;
if (QFile::exists(newInstallerFullPath))
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat); QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat);
@ -961,7 +956,6 @@ bool COperationDialog::createAddRemoveEntry()
// ModifyPath // ModifyPath
#endif #endif
} }
}
updateAddRemoveEntry(); updateAddRemoveEntry();
@ -974,14 +968,12 @@ bool COperationDialog::updateAddRemoveEntry()
{ {
CConfigFile *config = CConfigFile::getInstance(); CConfigFile *config = CConfigFile::getInstance();
QString newInstallerFullPath = config->getInstallerInstalledFilePath();
if (!newInstallerFullPath.isEmpty() && QFile::exists(newInstallerFullPath))
{
QString newInstallerFilename = config->getInstallerFilename(); QString newInstallerFilename = config->getInstallerFilename();
if (!newInstallerFilename.isEmpty())
{
QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename;
if (QFile::exists(newInstallerFullPath))
{
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat); QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat);
@ -995,7 +987,6 @@ bool COperationDialog::updateAddRemoveEntry()
settings.setValue("MinorVersion", versionTokens[1].toInt()); settings.setValue("MinorVersion", versionTokens[1].toInt());
#endif #endif
} }
}
return true; return true;
} }
@ -1161,7 +1152,7 @@ void COperationDialog::deleteComponentsInstaller()
dir.removeRecursively(); dir.removeRecursively();
} }
path = config->getInstallerOriginalDirPath(); path = config->getInstallerInstalledDirPath();
QStringList files = config->getInstallerRequiredFiles(); QStringList files = config->getInstallerRequiredFiles();
foreach(const QString &file, files) foreach(const QString &file, files)