From b308063431cb5a7ea71241bcf1a700641b567b23 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 27 Jul 2016 11:55:31 +0200 Subject: [PATCH] Changed: Delete installer files in TEMP directory after a reboot, see #279 --- .../ryzom_installer/src/operationdialog.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index eec9d231e..1a4cf9f13 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -1118,8 +1118,6 @@ void COperationDialog::deleteComponentsInstaller() CConfigFile *config = CConfigFile::getInstance(); - // TODO: delete installer - deleteAddRemoveEntry(); // delete menu @@ -1132,7 +1130,22 @@ void COperationDialog::deleteComponentsInstaller() dir.removeRecursively(); } - // TODO: + path = config->getInstallerFullPath(); + QStringList files = config->getInstallerRequiredFiles(); + + foreach(const QString &file, files) + { + QString fullPath = path + "/" + file; + + // delete file + if (!QFile::remove(fullPath)) + { +#ifdef Q_OS_WIN32 + // under Windows, a running executable is locked, so we need to delete it later + MoveFileExW(qToWide(QDir::toNativeSeparators(fullPath)), NULL, MOVEFILE_DELAY_UNTIL_REBOOT); +#endif + } + } // reset it once it's done m_removeComponents.installer = false;