From 469bd13a28a67d62c4c4acd83189e2bfbc2f7064 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 3 Nov 2016 14:42:07 +0100 Subject: [PATCH 1/3] Changed: Use QSaveFile to be sure the file is fully written --HG-- branch : develop --- .../tools/client/ryzom_installer/src/filesextractor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp index 241817e9c..d314dce93 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp @@ -462,7 +462,7 @@ bool CFilesExtractor::extract7z() } // create file - QFile outFile(destPath); + QSaveFile outFile(destPath); if (!outFile.open(QFile::WriteOnly)) { @@ -496,7 +496,7 @@ bool CFilesExtractor::extract7z() break; } - outFile.close(); + outFile.commit(); totalUncompressed += uncompressedSize; @@ -620,7 +620,7 @@ bool CFilesExtractor::extractZip() return true; } - QFile f(absPath); + QSaveFile f(absPath); if (!f.open(QIODevice::WriteOnly)) { @@ -637,7 +637,7 @@ bool CFilesExtractor::extractZip() nlwarning("Unable to change permissions of %s", Q2C(absPath)); } - f.close(); + f.commit(); // set the right modification date if (!NLMISC::CFile::setFileModificationDate(qToUtf8(absPath), fi.lastModified.toTime_t())) From ee2d17c24bc1997c6a0bf04695ee4419f524a989 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 3 Nov 2016 14:43:08 +0100 Subject: [PATCH 2/3] Changed: Don't try to copy Installer several times (if it fails once, it'll fail forever) --HG-- branch : develop --- .../ryzom/tools/client/ryzom_installer/src/configfile.cpp | 8 ++++---- code/ryzom/tools/client/ryzom_installer/src/configfile.h | 4 ++++ .../tools/client/ryzom_installer/src/operationdialog.cpp | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index cf5be876c..99f1a54a8 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -25,7 +25,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_defaultServerIndex(0), m_defaultProfileIndex(0), m_installerCopied(false), m_use64BitsClient(false), m_shouldUninstallOldClient(true) { s_instance = this; @@ -945,8 +945,8 @@ OperationStep CConfigFile::getInstallNextStep() const } } - // current installer more recent than installed one - if (compareInstallersVersion() == 1) return CopyInstaller; + // current installer more recent than installed one and not already copied + if (!m_installerCopied && compareInstallersVersion() == 1) return CopyInstaller; // no default profile if (profile.id.isEmpty()) @@ -992,7 +992,7 @@ OperationStep CConfigFile::getInstallNextStep() const // current installer more recent than installed one switch (compareInstallersVersion()) { - // current installer more recent, copy it + // current installer more recent, should be already copied case 1: break; // current installer older, launch the more recent installer diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index d1560c40e..df13b7a51 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -57,6 +57,9 @@ public: QString getLanguage() const { return m_language; } + bool getInstallerCopied() const { return m_installerCopied; } + void setInstallerCopied(bool copied) { m_installerCopied = copied; } + int getProfilesCount() const; CProfile getProfile(int i = -1) const; CProfile getProfile(const QString &id) const; @@ -145,6 +148,7 @@ private: int m_version; int m_defaultServerIndex; int m_defaultProfileIndex; + bool m_installerCopied; CServers m_servers; CProfiles m_profiles; diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index f9e086c16..f5dc89086 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -791,6 +791,9 @@ void COperationDialog::copyInstaller() #endif createShortcut(shortcut, name, executable, "", icon, ""); + + // installer already copied, don't need to copy it again + config->setInstallerCopied(true); } emit done(); From 11e9a7ea818de8be3f3589481ae4a52e4d18fc35 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 3 Nov 2016 14:44:01 +0100 Subject: [PATCH 3/3] Changed: Sleep 1 second after copying files (because to some disk cache) --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp b/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp index 1a8e6cfaf..8cfb3c0d5 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp @@ -194,6 +194,9 @@ bool CFilesCopier::copyFiles(const FilesToCopy &files) processedSize += file.size; } + // wait 1 second to be sure all files have been copied (because to disk cache) + QThread::sleep(1); + if (m_listener) { m_listener->operationSuccess(totalSize);