From 81300b8b130fa7818eeac08ce4edc33a43cec2d9 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 14 Aug 2016 12:49:39 +0200 Subject: [PATCH] Changed: Always copy installer if different, see #279 --- .../ryzom_installer/src/operationdialog.cpp | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 73fc76149..455ce0be5 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -713,23 +713,25 @@ void COperationDialog::copyInstaller() QString oldInstallerFullPath = QApplication::applicationFilePath(); QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename; - if (!QFile::exists(newInstallerFullPath)) + // always copy new installers + CFilesCopier copier(this); + copier.setIncludeFilter(config->getInstallerRequiredFiles()); + copier.addFile(oldInstallerFullPath); + copier.setSourceDirectory(config->getSrcServerDirectory().isEmpty() ? QApplication::applicationDirPath():config->getSrcServerDirectory()); + copier.setDestinationDirectory(config->getInstallationDirectory()); + copier.exec(); + + // copied file + oldInstallerFullPath = config->getInstallationDirectory() + "/" + QFileInfo(oldInstallerFullPath).fileName(); + + // rename old filename if different + if (oldInstallerFullPath != newInstallerFullPath) { - CFilesCopier copier(this); - copier.setIncludeFilter(config->getInstallerRequiredFiles()); - copier.addFile(oldInstallerFullPath); - copier.setSourceDirectory(config->getSrcServerDirectory().isEmpty() ? QApplication::applicationDirPath():config->getSrcServerDirectory()); - copier.setDestinationDirectory(config->getInstallationDirectory()); - copier.exec(); + // delete previous installer + QFile::remove(newInstallerFullPath); - // copied file - oldInstallerFullPath = config->getInstallationDirectory() + "/" + QFileInfo(oldInstallerFullPath).fileName(); - - // rename old filename if different - if (oldInstallerFullPath != newInstallerFullPath) - { - QFile::rename(oldInstallerFullPath, newInstallerFullPath); - } + // rename new installer with final name + QFile::rename(oldInstallerFullPath, newInstallerFullPath); } // create menu directory if defined