| 85 | } |
| 86 | |
| 87 | void UserPrefsHolder::Init() |
| 88 | { |
| 89 | mUserPrefsFile.open(TheSynth->GetUserPrefsPath()); |
| 90 | |
| 91 | // Look for overrides in command line options |
| 92 | for (int i = 0; i < juce::JUCEApplication::getCommandLineParameterArray().size(); ++i) |
| 93 | { |
| 94 | juce::String argument = juce::JUCEApplication::getCommandLineParameterArray()[i]; |
| 95 | if (argument == "-o" || argument == "--option") |
| 96 | { |
| 97 | juce::String argJsonOption = juce::JUCEApplication::getCommandLineParameterArray()[i + 1]; |
| 98 | auto value = juce::JUCEApplication::getCommandLineParameterArray()[i + 2].toStdString(); |
| 99 | auto& element = mUserPrefsFile[argJsonOption.toStdString()]; |
| 100 | try |
| 101 | { |
| 102 | setValueFromString(element, value); |
| 103 | } |
| 104 | catch (std::invalid_argument) |
| 105 | { |
| 106 | ofLog() << "Failed to convert argument " << value << " to the desired type"; |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | for (auto* pref : mUserPrefs) |
| 112 | pref->Init(); |
| 113 | } |
| 114 | |
| 115 | std::string UserPrefsHolder::ToStringLeadingZeroes(int number) |
| 116 | { |
nothing calls this directly
no test coverage detected