|
|
@@ -19,18 +19,19 @@ int main(int argc, char* argv[]) { |
|
|
|
randomInit(); |
|
|
|
loggerInit(); |
|
|
|
|
|
|
|
// Parse command line arguments |
|
|
|
std::string patchFile; |
|
|
|
if (argc >= 2) { |
|
|
|
patchFile = argv[1]; |
|
|
|
} |
|
|
|
|
|
|
|
info("Rack %s", gApplicationVersion.c_str()); |
|
|
|
|
|
|
|
{ |
|
|
|
char *cwd = getcwd(NULL, 0); |
|
|
|
info("Current working directory: %s", cwd); |
|
|
|
free(cwd); |
|
|
|
std::string globalDir = assetGlobal(""); |
|
|
|
std::string localDir = assetLocal(""); |
|
|
|
info("Global directory: %s", globalDir.c_str()); |
|
|
|
info("Local directory: %s", localDir.c_str()); |
|
|
|
} |
|
|
|
// Log directories |
|
|
|
info("Global directory: %s", assetGlobal("").c_str()); |
|
|
|
info("Local directory: %s", assetLocal("").c_str()); |
|
|
|
|
|
|
|
// Initialize namespaces |
|
|
|
pluginInit(); |
|
|
|
engineInit(); |
|
|
|
midiInit(); |
|
|
@@ -38,25 +39,33 @@ int main(int argc, char* argv[]) { |
|
|
|
windowInit(); |
|
|
|
appInit(); |
|
|
|
settingsLoad(assetLocal("settings.json")); |
|
|
|
std::string oldLastPath = gRackWidget->lastPath; |
|
|
|
|
|
|
|
// To prevent launch crashes, if Rack crashes between now and 15 seconds from now, the "skipAutosaveOnLaunch" property will remain in settings.json, so that in the next launch, the broken autosave will not be loaded. |
|
|
|
bool oldSkipAutosaveOnLaunch = skipAutosaveOnLaunch; |
|
|
|
skipAutosaveOnLaunch = true; |
|
|
|
settingsSave(assetLocal("settings.json")); |
|
|
|
skipAutosaveOnLaunch = false; |
|
|
|
if (oldSkipAutosaveOnLaunch && osdialog_message(OSDIALOG_INFO, OSDIALOG_YES_NO, "Rack has recovered from a crash, possibly caused by a faulty module in your patch. Would you like to clear your patch and start over?")) { |
|
|
|
// Do nothing. Empty patch is already loaded. |
|
|
|
if (patchFile.empty()) { |
|
|
|
std::string oldLastPath = gRackWidget->lastPath; |
|
|
|
// To prevent launch crashes, if Rack crashes between now and 15 seconds from now, the "skipAutosaveOnLaunch" property will remain in settings.json, so that in the next launch, the broken autosave will not be loaded. |
|
|
|
bool oldSkipAutosaveOnLaunch = skipAutosaveOnLaunch; |
|
|
|
skipAutosaveOnLaunch = true; |
|
|
|
settingsSave(assetLocal("settings.json")); |
|
|
|
skipAutosaveOnLaunch = false; |
|
|
|
if (oldSkipAutosaveOnLaunch && osdialog_message(OSDIALOG_INFO, OSDIALOG_YES_NO, "Rack has recovered from a crash, possibly caused by a faulty module in your patch. Would you like to clear your patch and start over?")) { |
|
|
|
// Do nothing. Empty patch is already loaded. |
|
|
|
} |
|
|
|
else { |
|
|
|
// Load autosave |
|
|
|
gRackWidget->loadPatch(assetLocal("autosave.vcv")); |
|
|
|
} |
|
|
|
gRackWidget->lastPath = oldLastPath; |
|
|
|
} |
|
|
|
else { |
|
|
|
gRackWidget->loadPatch(assetLocal("autosave.vcv")); |
|
|
|
// Load patch |
|
|
|
gRackWidget->loadPatch(patchFile); |
|
|
|
} |
|
|
|
gRackWidget->lastPath = oldLastPath; |
|
|
|
|
|
|
|
engineStart(); |
|
|
|
windowRun(); |
|
|
|
engineStop(); |
|
|
|
|
|
|
|
// Destroy namespaces |
|
|
|
gRackWidget->savePatch(assetLocal("autosave.vcv")); |
|
|
|
settingsSave(assetLocal("settings.json")); |
|
|
|
appDestroy(); |
|
|
|