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

Function LoadJsonFromFile

Rtxpt/SampleCommon/SampleCommon.cpp:111–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111bool LoadJsonFromFile( const std::filesystem::path & filePath, Json::Value & outRootNode )
112{
113 std::ifstream inFile;
114 inFile.open(filePath);
115
116 if (!inFile.is_open())
117 {
118 inFile.open(filePath);
119 if (!inFile.is_open())
120 {
121 donut::log::warning("Error attempting to load json file '%s'", filePath.string().c_str());
122 return false;
123 }
124 }
125
126 try { inFile >> outRootNode; }
127 catch (const Json::RuntimeError& e)
128 { donut::log::warning("Caught Json::RuntimeError: %s", e.what()); return false; }
129 catch (const std::exception& e)
130 { donut::log::warning("Caught std::exception: %s", e.what()); return false; }
131 return true;
132}
133
134std::string SaveJsonToString( const Json::Value & rootNode )
135{

Callers 3

LoadMethod · 0.85
LoadSingleMethod · 0.85
SceneLoadedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected