MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / CreateObjectFromJsonFile

Function CreateObjectFromJsonFile

src/openrct2/object/ObjectFactory.cpp:474–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472 }
473
474 std::unique_ptr<Object> CreateObjectFromJsonFile(const std::string& path, bool loadImages)
475 {
476 LOG_VERBOSE("CreateObjectFromJsonFile(\"%s\")", path.c_str());
477
478 try
479 {
480 json_t jRoot = Json::ReadFromFile(path.c_str());
481 auto fileDataRetriever = FileSystemDataRetriever(Path::GetDirectory(path));
482 return CreateObjectFromJson(jRoot, &fileDataRetriever, loadImages, path);
483 }
484 catch (const std::runtime_error& err)
485 {
486 Console::Error::WriteLine("Unable to open or read '%s': %s", path.c_str(), err.what());
487 }
488
489 return nullptr;
490 }
491
492 static void ExtractSourceGames(const std::string& id, json_t& jRoot, Object& result)
493 {

Callers 1

CreateObjectFromFileFunction · 0.85

Calls 6

GetDirectoryFunction · 0.85
CreateObjectFromJsonFunction · 0.85
WriteLineFunction · 0.85
ReadFromFileFunction · 0.50
whatMethod · 0.45

Tested by

no test coverage detected