From 277aa36d1288d619b963ab6ffcd98b5515e030e7 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 14 Oct 2022 23:23:37 -0700 Subject: [PATCH] Qt: Manually split filename to avoid overzealous splitting (fixes #2681) --- CHANGES | 1 + src/platform/qt/ApplicationUpdater.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index b5df6a2be..36adbc375 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ 0.10.1: (Future) Other fixes: + - Qt: Manually split filename to avoid overzealous splitting (fixes mgba.io/i/2681) - Res: Fix species name location in Ruby/Sapphire revs 1/2 (fixes mgba.io/i/2685) 0.10.0: (2022-10-11) diff --git a/src/platform/qt/ApplicationUpdater.cpp b/src/platform/qt/ApplicationUpdater.cpp index ce752ecce..f26e58101 100644 --- a/src/platform/qt/ApplicationUpdater.cpp +++ b/src/platform/qt/ApplicationUpdater.cpp @@ -137,7 +137,15 @@ QUrl ApplicationUpdater::parseManifest(const QByteArray& manifest) { QString ApplicationUpdater::destination() const { QFileInfo path(updateInfo().url.path()); QDir dir(ConfigController::configDir()); - return dir.filePath(QLatin1String("update.") + path.completeSuffix()); + // QFileInfo::completeSuffix will eat all .'s in the filename...including + // ones in the version string, turning mGBA-1.0.0-win32.7z into + // 0.0-win32.7z instead of the intended .7z + // As a result, so we have to split out the complete suffix manually. + QString suffix(path.suffix()); + if (path.completeBaseName().endsWith(".tar")) { + suffix = "tar." + suffix; + } + return dir.filePath(QLatin1String("update.") + suffix); } const char* ApplicationUpdater::platform() {