Skip to content

Commit ded1220

Browse files
committed
Add check to only load savefiles generated by a plugin version of the GUI
1 parent bf75653 commit ded1220

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

Source/UI/EditorViewport.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,9 @@ const String EditorViewport::saveState(File fileToUse)
12611261
XmlElement* version = info->createNewChildElement("VERSION");
12621262
version->addTextElement(JUCEApplication::getInstance()->getApplicationVersion());
12631263

1264+
XmlElement* pluginAPIVersion = info->createNewChildElement("PLUGIN_API_VERSION");
1265+
pluginAPIVersion->addTextElement(String(PLUGIN_API_VER));
1266+
12641267
Time currentTime = Time::getCurrentTime();
12651268

12661269
XmlElement* date = info->createNewChildElement("DATE");
@@ -1438,8 +1441,9 @@ const String EditorViewport::loadState(File fileToLoad)
14381441
}
14391442

14401443
bool sameVersion = false;
1444+
bool pluginAPI = false;
14411445
String versionString;
1442-
1446+
14431447
forEachXmlChildElement(*xml, element)
14441448
{
14451449
if (element->hasTagName("INFO"))
@@ -1455,6 +1459,13 @@ const String EditorViewport::loadState(File fileToLoad)
14551459
if (versionString.equalsIgnoreCase(JUCEApplication::getInstance()->getApplicationVersion()))
14561460
sameVersion = true;
14571461
}
1462+
else if (element2->hasTagName("PLUGIN_API_VERSION"))
1463+
{
1464+
//API version should be the same between the same binary release and, in any case, do not necessarily
1465+
//change processor configurations. We simply check if the save file has been written from a plugin
1466+
//capable build, as the save format itself is different.
1467+
pluginAPI = true;
1468+
}
14581469
}
14591470
break;
14601471
}
@@ -1484,6 +1495,14 @@ const String EditorViewport::loadState(File fileToLoad)
14841495
return "Failed To Open " + fileToLoad.getFileName();
14851496

14861497
}
1498+
if (!pluginAPI)
1499+
{
1500+
String responseString = "Your configuration file was saved from a non-plugin version of the GUI.\n";
1501+
responseString += "Save files from non-plugin versions are incompatible with the current load system.\n";
1502+
responseString += "The chain file will not load.";
1503+
AlertWindow::showMessageBox(AlertWindow::WarningIcon, "Non-plugin save file", responseString);
1504+
return "Failed To Open " + fileToLoad.getFileName();
1505+
}
14871506
clearSignalChain();
14881507

14891508
String description;// = " ";

0 commit comments

Comments
 (0)