From cc8d7b86404f2830bcf09d04468e8041db276b98 Mon Sep 17 00:00:00 2001 From: Craig Robbins Date: Fri, 7 Nov 2014 11:47:07 +1000 Subject: [PATCH] Stop inserting empty lines at end of minetest.conf file each time it is rewritten See: https://github.com/minetest/minetest/issues/1790 --- src/settings.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/settings.cpp b/src/settings.cpp index ca0775330..65896ef27 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -667,8 +667,9 @@ void Settings::getUpdatedConfigObject(std::istream &is, bool &changed) { std::string name, value; + if (!parseConfigObject(is, name, value)) { - dst.push_back(value + '\n'); + dst.push_back(value + (is.eof() ? "" : "\n")); return; } @@ -679,7 +680,7 @@ void Settings::getUpdatedConfigObject(std::istream &is, changed = true; } - dst.push_back(name + " = " + new_value + '\n'); + dst.push_back(name + " = " + new_value + (is.eof() ? "" : "\n")); updated.insert(name); } else { // File contains a setting which is not in m_settings changed = true; -- 2.25.1