MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Save

Method Save

Source/UserPrefsEditor.cpp:396–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396void UserPrefsEditor::Save()
397{
398 //make a copy
399 ofxJSONElement prefsFile = UserPrefs.mUserPrefsFile;
400
401 //remove legacy prefs
402 prefsFile.removeMember("vstsearchdirs");
403 prefsFile.removeMember("youtube-dl_path");
404
405 for (int i = 0; i < (int)UserPrefs.mUserPrefs.size(); ++i)
406 UserPrefs.mUserPrefs[i]->Save(i, prefsFile);
407
408 std::string output = prefsFile.getRawString(true);
409 CleanUpSave(output);
410
411 juce::File file(TheSynth->GetUserPrefsPath());
412 file.create();
413 file.replaceWithText(output);
414
415 if (TheSynth->HasFatalError()) //this popup spawned at load due to a bad init setting. in this case, the button says "save and exit"
416 juce::JUCEApplicationBase::quit();
417}
418
419void UserPrefsEditor::ButtonClicked(ClickButton* button, double time)
420{

Callers

nothing calls this directly

Calls 5

sizeMethod · 0.80
getRawStringMethod · 0.80
GetUserPrefsPathMethod · 0.80
createMethod · 0.80
HasFatalErrorMethod · 0.80

Tested by

no test coverage detected