update pretty print save to file
This commit is contained in:
parent
37330ca005
commit
8d4fccba5f
1 changed files with 9 additions and 0 deletions
|
|
@ -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 )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue