From 6b5596533b63e6568dcce1eeac694fa38a7d00ce Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 28 Sep 2016 23:29:02 +0200 Subject: [PATCH] Fixed: Remove all directories from data excepted fonts one --- .../client/ryzom_installer/src/configfile.cpp | 16 +++++++++--- .../ryzom_installer/src/filescleaner.cpp | 26 +++++++++++++++---- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 8ee369b5c..6466f299e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -639,20 +639,28 @@ bool CConfigFile::foundTemporaryFiles(const QString &directory) const QStringList filter; filter << "*.string_cache"; + // certificate should be in gamedev.bnp now + filter << "*.pem"; + + // only .ref files should be there + filter << "exedll*.bnp"; + if (dir.exists("packedsheets.bnp")) { filter << "*.packed_sheets"; filter << "*.packed"; - filter << "*.pem"; } // temporary files if (!dir.entryList(filter, QDir::Files).isEmpty()) return true; - // fonts directory is not needed anymore - if (dir.exists("fonts.bnp") && !dir.cd("fonts")) return true; + // temporary directories + QStringList dirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); - return false; + // fonts directory is not needed anymore if fonts.bnp exists + if (!dir.exists("fonts.bnp")) dirs.removeAll("fonts"); + + return !dirs.isEmpty(); } bool CConfigFile::shouldCreateDesktopShortcut() const diff --git a/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp b/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp index 0dab15a59..2dd89eb00 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp @@ -60,12 +60,21 @@ bool CFilesCleaner::exec() filter << "*.packed"; } + // only .ref files should be there + filter << "exedll*.bnp"; + // temporary files QStringList files = dir.entryList(filter, QDir::Files); + // temporary directories + QStringList dirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + + // fonts directory is not needed anymore if fonts.bnp exists + if (!dir.exists("fonts.bnp")) dirs.removeAll("fonts"); + if (m_listener) { - m_listener->operationInit(0, files.size()); + m_listener->operationInit(0, files.size() + dirs.size()); m_listener->operationStart(); } @@ -80,13 +89,20 @@ bool CFilesCleaner::exec() ++filesCount; } - // fonts directory is not needed anymore if fonts.bnp exists - if (dir.exists("fonts.bnp") && dir.cd("fonts")) + foreach(const QString &d, dirs) { - dir.removeRecursively(); + if (dir.cd(d)) + { + dir.removeRecursively(); + dir.cdUp(); + } + + if (m_listener) m_listener->operationProgress(filesCount, d); + + ++filesCount; } - if (m_listener) m_listener->operationSuccess(files.size()); + if (m_listener) m_listener->operationSuccess(files.size() + dirs.size()); return true; }