From bfc92ddecf9b85030ef6bb30e45935c25802a5a7 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Sat, 5 May 2018 20:05:41 +0200 Subject: [PATCH] do not write useless empty line at beginning of map file --- libs/script/scripttokenwriter.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/script/scripttokenwriter.h b/libs/script/scripttokenwriter.h index 49ee57af..f1c5fc31 100644 --- a/libs/script/scripttokenwriter.h +++ b/libs/script/scripttokenwriter.h @@ -28,7 +28,8 @@ class SimpleTokenWriter : public TokenWriter { public: SimpleTokenWriter( TextOutputStream& ostream ) - : m_ostream( ostream ), m_separator( '\n' ){ + // HACK: \0 separator is used to tell we are at beginning of file + : m_ostream( ostream ), m_separator( '\0' ){ } ~SimpleTokenWriter(){ writeSeparator(); @@ -63,7 +64,10 @@ void writeFloat( double f ){ private: void writeSeparator(){ - m_ostream << m_separator; + // HACK: do not write separator at beginning of file + if (m_separator != '\0') { + m_ostream << m_separator; + } m_separator = ' '; } TextOutputStream& m_ostream; -- 2.39.2