| 94 | } |
| 95 | |
| 96 | bool 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 | |
| 111 | bool LoadJsonFromFile( const std::filesystem::path & filePath, Json::Value & outRootNode ) |
| 112 | { |