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

Function save

src/settings.cpp:584–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582}
583
584void save(std::string path) {
585 if (path.empty())
586 path = settingsPath;
587
588 INFO("Saving settings %s", path.c_str());
589 json_t* rootJ = toJson();
590 if (!rootJ)
591 return;
592 DEFER({json_decref(rootJ);});
593
594 std::string tmpPath = path + ".tmp";
595 FILE* file = std::fopen(tmpPath.c_str(), "w");
596 if (!file)
597 return;
598
599 json_dumpf(rootJ, file, JSON_INDENT(2));
600 std::fclose(file);
601 system::rename(tmpPath, path);
602}
603
604void load(std::string path) {
605 if (path.empty())

Callers 7

mainFunction · 0.85
saveDialogMethod · 0.85
saveAsDialogMethod · 0.85
saveTemplateDialogMethod · 0.85
stepMethod · 0.85
saveTemplateMethod · 0.85
saveDialogMethod · 0.85

Calls 3

toJsonFunction · 0.85
renameFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected