| 1047 | } |
| 1048 | |
| 1049 | void loadTemplate(const bool factory) |
| 1050 | { |
| 1051 | try { |
| 1052 | APP->patch->load(factory ? APP->patch->factoryTemplatePath : APP->patch->templatePath); |
| 1053 | } |
| 1054 | catch (Exception& e) { |
| 1055 | // if user template failed, try the factory one |
| 1056 | if (!factory) |
| 1057 | return loadTemplate(true); |
| 1058 | |
| 1059 | const std::string message = string::f("Could not load template patch, clearing rack: %s", e.what()); |
| 1060 | asyncDialog::create(message.c_str()); |
| 1061 | |
| 1062 | APP->patch->clear(); |
| 1063 | APP->patch->clearAutosave(); |
| 1064 | } |
| 1065 | |
| 1066 | // load() sets the patch's original patch, but we don't want to use that. |
| 1067 | APP->patch->path.clear(); |
| 1068 | APP->history->setSaved(); |
| 1069 | |
| 1070 | #ifdef DISTRHO_OS_WASM |
| 1071 | syncfs(); |
| 1072 | #endif |
| 1073 | |
| 1074 | if (remoteUtils::RemoteDetails* const remoteDetails = remoteUtils::getRemote()) |
| 1075 | if (remoteDetails->autoDeploy) |
| 1076 | remoteUtils::sendFullPatchToRemote(remoteDetails); |
| 1077 | } |
| 1078 | |
| 1079 | |
| 1080 | void loadTemplateDialog(const bool factory) |
no test coverage detected