From 86becb1407b18dfc8d3ef091d409c819198626c9 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 29 Jun 2024 11:00:48 -0400 Subject: [PATCH] Don't store patches in temp directories anymore This was causing memory issues on systems (like Linux/Flatpak) where the temp directory existed on tmpfs (aka RAM). Now they're stored in app data and deleted when we're finished with them. Fixes #17 (cherry picked from commit 99785e5d68124bd94df622bd717a208d9fbdaa12) --- launcher/src/patcher.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/launcher/src/patcher.cpp b/launcher/src/patcher.cpp index 5f2f69b..bc861d4 100644 --- a/launcher/src/patcher.cpp +++ b/launcher/src/patcher.cpp @@ -233,16 +233,16 @@ void Patcher::processPatch(const QueuedPatch &patch) } Utility::writeVersion(verFilePath, patch.version); + + if (!m_launcher.settings()->keepPatches()) { + QFile::remove(patch.path); + } } void Patcher::setupDirectories() { QDir dataDir; - if (m_launcher.settings()->keepPatches()) { - dataDir.setPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); - } else { - dataDir.setPath(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); - } + dataDir.setPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); m_patchesDir.setPath(dataDir.absoluteFilePath(QStringLiteral("patch"))); }