Qt: Manually split filename to avoid overzealous splitting (fixes #2681)

This commit is contained in:
Vicki Pfau 2022-10-14 23:23:37 -07:00
parent 5067eb621c
commit d5669c2872
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,6 @@
0.11.0: (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)

View File

@ -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() {