From b429561bc8a42420bf9cc24d4d3267f006bb6fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Thu, 15 Oct 2026 19:34:01 +0200 Subject: [PATCH] [Client] Read path settings inside isPortableBackupExcluded --- cockatrice/src/interface/window_main.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/cockatrice/src/interface/window_main.cpp b/cockatrice/src/interface/window_main.cpp index 5d3e90f2b..e19bb6199 100644 --- a/cockatrice/src/interface/window_main.cpp +++ b/cockatrice/src/interface/window_main.cpp @@ -662,13 +662,15 @@ static QString resolveBackupRoot(const QString &appDir) // True when a portable offender must stay out of the safety backup: replays (size), // downloaded pictures (large and re-downloadable - everything under pics/ except the // seeded CUSTOM dir) and the regenerable redirect/cache dir. -static bool isPortableBackupExcluded(const QString &offender, - const QString &replaysPath, - const QString &picsPath, - const QString &customPicsPath, - const QString &redirectsPath, - const QString &cacheDir) +static bool isPortableBackupExcluded(const QString &offender) { + auto &paths = SettingsCache::instance().paths(); + const QString replaysPath = QDir::cleanPath(paths.getReplaysPath()); + const QString picsPath = QDir::cleanPath(paths.getPicsPath()); + const QString customPicsPath = QDir::cleanPath(paths.getCustomPicsPath()); + const QString redirectsPath = QDir::cleanPath(paths.getRedirectCachePath()); + const QString cacheDir = QDir::cleanPath(SettingsCache::instance().getCachePath()); + if (!replaysPath.isEmpty() && PathsSettings::isInsideDir(offender, replaysPath)) { return true; } @@ -734,17 +736,12 @@ MainWindow::AtRiskPaths MainWindow::collectPortableAtRiskPaths(const QString &ap // old uninstaller deletes all the same. Cover any offender that is not // already inside a backed-up source; when an offender is a parent of // already-collected sources it supersedes them. - const QString replaysPath = QDir::cleanPath(paths.getReplaysPath()); - const QString picsPath = QDir::cleanPath(paths.getPicsPath()); - const QString customPicsPath = QDir::cleanPath(paths.getCustomPicsPath()); - const QString redirectsPath = QDir::cleanPath(paths.getRedirectCachePath()); - const QString cacheDir = QDir::cleanPath(SettingsCache::instance().getCachePath()); for (const QString &offender : paths.pathsInsideDir(appDir)) { if (!QFileInfo::exists(offender)) { continue; } const QString cleanedOffender = QDir::cleanPath(offender); - if (isPortableBackupExcluded(cleanedOffender, replaysPath, picsPath, customPicsPath, redirectsPath, cacheDir)) { + if (isPortableBackupExcluded(cleanedOffender)) { continue; } mergeCoveringSource(atRisk.sourcesToBackUp, cleanedOffender);