MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXPT / SaveJsonToFile

Function SaveJsonToFile

Rtxpt/SampleCommon/SampleCommon.cpp:96–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96bool SaveJsonToFile( const std::filesystem::path & filePath, const class Json::Value & rootNode )
97{
98 std::ofstream outFile(filePath, std::ios::trunc);
99 if (!outFile.is_open())
100 {
101 log::error("Error attempting to save json contents to file '%s'", filePath.string().c_str());
102 return false;
103 }
104 Json::StreamWriterBuilder builder;
105 std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
106 writer->write(rootNode, &outFile);
107 outFile.close();
108 return true;
109}
110
111bool LoadJsonFromFile( const std::filesystem::path & filePath, Json::Value & outRootNode )
112{

Callers 2

DebugGUIMethod · 0.85
GUIMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected