update pretty print save to file

This commit is contained in:
Daniel Larimer 2014-05-11 20:33:08 -04:00
parent 37330ca005
commit 8d4fccba5f

View file

@ -608,8 +608,17 @@ namespace fc
void json::save_to_file( const variant& v, const fc::path& fi, bool pretty ) 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::ofstream o(fi);
fc::to_stream( o, v ); fc::to_stream( o, v );
}
} }
variant json::from_file( const fc::path& p ) variant json::from_file( const fc::path& p )
{ {