]> git.tdb.fi Git - builder.git/commitdiff
Use DataFile::Writer to write package configuration files
authorMikko Rasa <tdb@tdb.fi>
Mon, 19 Dec 2022 18:04:40 +0000 (20:04 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 19 Dec 2022 18:04:56 +0000 (20:04 +0200)
source/config.cpp

index 67f932fbafe9fa29fc06d0a0637027badb42e8a4..4e57fdfbbc70e6f8afbbef45f866f2ac94b5b3bb 100644 (file)
@@ -1,4 +1,5 @@
 #include <msp/core/maputils.h>
+#include <msp/datafile/writer.h>
 #include <msp/fs/stat.h>
 #include <msp/fs/utils.h>
 #include <msp/io/file.h>
@@ -81,9 +82,10 @@ void Config::save() const
 
        package.get_builder().get_logger().log("files", format("Writing %s", fn));
        IO::BufferedFile out(fn.str(), IO::M_WRITE);
+       DataFile::Writer writer(out);
 
        for(const auto &kvp: options)
-               IO::print(out, "option \"%s\" \"%s\";\n", kvp.second.name, kvp.second.value);
+               writer.write((DataFile::Statement("option"), kvp.second.name, kvp.second.value));
 
        changed = false;
 }