From 8d4fccba5fe5e48e01344022c416c7d091ab6f2a Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Sun, 11 May 2014 20:33:08 -0400 Subject: [PATCH] update pretty print save to file --- src/io/json.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/io/json.cpp b/src/io/json.cpp index 54b63f3..7fa05e8 100644 --- a/src/io/json.cpp +++ b/src/io/json.cpp @@ -608,8 +608,17 @@ namespace fc void json::save_to_file( const variant& v, const fc::path& fi, bool pretty ) { + if( pretty ) + { + auto str = json::to_pretty_string( v ); + fc::ofstream o(fi); + o.write( str.c_str(), str.size() ); + } + else + { fc::ofstream o(fi); fc::to_stream( o, v ); + } } variant json::from_file( const fc::path& p ) {