MCPcopy Create free account
hub / github.com/VCVRack/Rack / load

Function load

src/settings.cpp:604–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604void load(std::string path) {
605 if (path.empty())
606 path = settingsPath;
607
608 INFO("Loading settings %s", path.c_str());
609 FILE* file = std::fopen(path.c_str(), "r");
610 if (!file)
611 return;
612 DEFER({std::fclose(file);});
613
614 json_error_t error;
615 json_t* rootJ = json_loadf(file, 0, &error);
616 if (!rootJ)
617 throw Exception("Settings file has invalid JSON at %d:%d %s", error.line, error.column, error.text);
618 DEFER({json_decref(rootJ);});
619
620 fromJson(rootJ);
621}
622
623
624} // namespace settings

Callers 15

mainFunction · 0.85
loadTemplateMethod · 0.85
loadActionMethod · 0.85
PlugWidgetMethod · 0.85
loadActionMethod · 0.85
loadTemplateMethod · 0.85
stepMethod · 0.85
createPanelFunction · 0.85
LargeLightMethod · 0.85
MediumLightMethod · 0.85
SmallLightMethod · 0.85
TinyLightMethod · 0.85

Calls 3

ExceptionClass · 0.85
fromJsonFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected