mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-02 03:16:58 +03:00
Merge pull request #3130 from Kationor/trimversion
Improve MANIFEST.MF parsing
This commit is contained in:
commit
6c062c48b4
1 changed files with 6 additions and 3 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
|
||||
#include "FileSystem.h"
|
||||
|
|
@ -15,6 +16,8 @@
|
|||
#include "minecraft/mod/ModDetails.h"
|
||||
#include "settings/INIFile.h"
|
||||
|
||||
static QRegularExpression newlineRegex("\r\n|\n|\r");
|
||||
|
||||
namespace ModUtils {
|
||||
|
||||
// NEW format
|
||||
|
|
@ -487,11 +490,11 @@ bool processZIP(Mod& mod, [[maybe_unused]] ProcessingLevel level)
|
|||
}
|
||||
|
||||
// quick and dirty line-by-line parser
|
||||
auto manifestLines = file.readAll().split('\n');
|
||||
auto manifestLines = QString(file.readAll()).split(newlineRegex);
|
||||
QString manifestVersion = "";
|
||||
for (auto& line : manifestLines) {
|
||||
if (QString(line).startsWith("Implementation-Version: ")) {
|
||||
manifestVersion = QString(line).remove("Implementation-Version: ");
|
||||
if (line.startsWith("Implementation-Version: ", Qt::CaseInsensitive)) {
|
||||
manifestVersion = line.remove("Implementation-Version: ", Qt::CaseInsensitive);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue