MCPcopy Create free account
hub / github.com/XorTroll/uLaunch / LoadJSONFromFile

Function LoadJSONFromFile

libs/uCommon/source/ul/util/util_Json.cpp:7–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5namespace ul::util {
6
7 Result LoadJSONFromFile(JSON &out_json, const std::string &path) {
8 if(fs::ExistsFile(path)) {
9 std::string json_str;
10 if(fs::ReadFileString(path, json_str)) {
11 out_json = JSON::parse(json_str);
12 return ResultSuccess;
13 }
14 }
15
16 return ResultInvalidJson;
17 }
18
19 bool SaveJSON(const std::string &path, const JSON &json) {
20 const auto json_str = json.dump(4);

Callers 5

InitializeResourcesFunction · 0.85
FindRootFolderPathFunction · 0.85
ConvertPreV100MenuFunction · 0.85
LoadEntriesFunction · 0.85
LoadLanguageJsonsFunction · 0.85

Calls 2

ExistsFileFunction · 0.85
ReadFileStringFunction · 0.85

Tested by

no test coverage detected