|
|
@ -165,12 +165,10 @@ bool Config::GameSettings::readFile(QTextStream& stream, QMultiMap<QString, QStr
|
|
|
|
bool Config::GameSettings::writeFile(QTextStream& stream)
|
|
|
|
bool Config::GameSettings::writeFile(QTextStream& stream)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Iterate in reverse order to preserve insertion order
|
|
|
|
// Iterate in reverse order to preserve insertion order
|
|
|
|
QMapIterator<QString, QString> i(mUserSettings);
|
|
|
|
auto i = mUserSettings.end();
|
|
|
|
i.toBack();
|
|
|
|
while (i != mUserSettings.begin())
|
|
|
|
|
|
|
|
|
|
|
|
while (i.hasPrevious())
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
i.previous();
|
|
|
|
i--;
|
|
|
|
|
|
|
|
|
|
|
|
// path lines (e.g. 'data=...') need quotes and ampersands escaping to match how boost::filesystem::path uses
|
|
|
|
// path lines (e.g. 'data=...') need quotes and ampersands escaping to match how boost::filesystem::path uses
|
|
|
|
// boost::io::quoted
|
|
|
|
// boost::io::quoted
|
|
|
@ -388,12 +386,10 @@ bool Config::GameSettings::writeFileWithComments(QFile& file)
|
|
|
|
|
|
|
|
|
|
|
|
// Iterate in reverse order to preserve insertion order
|
|
|
|
// Iterate in reverse order to preserve insertion order
|
|
|
|
QString settingLine;
|
|
|
|
QString settingLine;
|
|
|
|
QMapIterator<QString, QString> it(mUserSettings);
|
|
|
|
auto it = mUserSettings.end();
|
|
|
|
it.toBack();
|
|
|
|
while (it != mUserSettings.begin())
|
|
|
|
|
|
|
|
|
|
|
|
while (it.hasPrevious())
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.previous();
|
|
|
|
it--;
|
|
|
|
|
|
|
|
|
|
|
|
if (it.key() == QLatin1String("data") || it.key() == QLatin1String("data-local")
|
|
|
|
if (it.key() == QLatin1String("data") || it.key() == QLatin1String("data-local")
|
|
|
|
|| it.key() == QLatin1String("resources") || it.key() == QLatin1String("load-savegame"))
|
|
|
|
|| it.key() == QLatin1String("resources") || it.key() == QLatin1String("load-savegame"))
|
|
|
|