1
0
Fork 0

Stop inserting empty lines at end of minetest.conf file each time it is rewritten

See: https://github.com/minetest/minetest/issues/1790
mutilcraft-mt53
Craig Robbins 2014-11-07 11:47:07 +10:00 committed by RealBadAngel
parent 1c21e391ed
commit cc8d7b8640
1 changed files with 3 additions and 2 deletions

View File

@ -667,8 +667,9 @@ void Settings::getUpdatedConfigObject(std::istream &is,
bool &changed) bool &changed)
{ {
std::string name, value; std::string name, value;
if (!parseConfigObject(is, name, value)) { if (!parseConfigObject(is, name, value)) {
dst.push_back(value + '\n'); dst.push_back(value + (is.eof() ? "" : "\n"));
return; return;
} }
@ -679,7 +680,7 @@ void Settings::getUpdatedConfigObject(std::istream &is,
changed = true; changed = true;
} }
dst.push_back(name + " = " + new_value + '\n'); dst.push_back(name + " = " + new_value + (is.eof() ? "" : "\n"));
updated.insert(name); updated.insert(name);
} else { // File contains a setting which is not in m_settings } else { // File contains a setting which is not in m_settings
changed = true; changed = true;