mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-16 16:10:58 +00:00
Handle replace= lines properly in the launcher
This commit is contained in:
parent
626f438dcc
commit
90966ecc47
@ -98,8 +98,32 @@ bool Config::GameSettings::readUserFile(QTextStream& stream, bool ignoreContent)
|
||||
bool Config::GameSettings::readFile(QTextStream& stream, QMultiMap<QString, QString>& settings, bool ignoreContent)
|
||||
{
|
||||
QMultiMap<QString, QString> cache;
|
||||
QRegularExpression replaceRe("^\\s*replace\\s*=\\s*(.+)$");
|
||||
QRegularExpression keyRe("^([^=]+)\\s*=\\s*(.+)$");
|
||||
|
||||
auto initialPos = stream.pos();
|
||||
|
||||
while (!stream.atEnd())
|
||||
{
|
||||
QString line = stream.readLine();
|
||||
|
||||
if (line.isEmpty() || line.startsWith("#"))
|
||||
continue;
|
||||
|
||||
QRegularExpressionMatch match = keyRe.match(line);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
QString key = match.captured(1).trimmed();
|
||||
// Replace composing entries with a replace= line
|
||||
if (key == QLatin1String("data") || key == QLatin1String("fallback-archive")
|
||||
|| key == QLatin1String("content") || key == QLatin1String("groundcover")
|
||||
|| key == QLatin1String("script-blacklist"))
|
||||
settings.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
stream.seek(initialPos);
|
||||
|
||||
while (!stream.atEnd())
|
||||
{
|
||||
QString line = stream.readLine();
|
||||
|
Loading…
Reference in New Issue
Block a user