1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-23 20:09:43 +00:00

Merge branch 'commas-arent-special' into 'master'

Don't give commas special meaning when matching comments to openmw.cfg values

Closes #8287

See merge request OpenMW/openmw!4507
This commit is contained in:
psi29a 2025-01-12 17:57:54 +00:00
commit 73161e6b64
2 changed files with 5 additions and 6 deletions

View file

@ -310,6 +310,7 @@
Feature #8109: Expose commitCrime to Lua API
Feature #8130: Launcher: Add the ability to open a selected data directory in the file browser
Feature #8145: Starter spell flag is not exposed
Feature #8287: Launcher: Special handling for comma in openmw.cfg entries is unintuitive and should be removed
Task #5859: User openmw-cs.cfg has comment talking about settings.cfg
Task #5896: Do not use deprecated MyGUI properties
Task #6085: Replace boost::filesystem with std::filesystem

View file

@ -274,9 +274,8 @@ bool Config::GameSettings::isOrderedLine(const QString& line)
// - Always ignore a line beginning with '#' or empty lines; added above a config
// entry.
//
// - If a line in file exists with matching key and first part of value (before ',',
// '\n', etc) also matches, then replace the line with that of mUserSettings.
// - else remove line
// - If a line in file exists with matching key and value, then replace the line with that of mUserSettings.
// - else if only the key matches, remove comment
//
// - If there is no corresponding line in file, add at the end
//
@ -325,7 +324,7 @@ bool Config::GameSettings::writeFileWithComments(QFile& file)
// +----------------------------------------------------------+
//
//
QRegularExpression settingRegex("^([^=]+)\\s*=\\s*([^,]+)(.*)$");
QRegularExpression settingRegex("^([^=]+)\\s*=\\s*(.+?)\\s*$");
std::vector<QString> comments;
auto commentStart = fileCopy.end();
std::map<QString, std::vector<QString>> commentsMap;
@ -395,8 +394,7 @@ bool Config::GameSettings::writeFileWithComments(QFile& file)
// look for a key in the line
if (!match.hasMatch() || settingRegex.captureCount() < 2)
{
// no key or first part of value found in line, replace with a null string which
// will be removed later
// no key or no value found in line, replace with a null string which will be removed later
*iter = QString();
comments.clear();
commentStart = fileCopy.end();