Skip to content

Commit 701c57b

Browse files
committed
Add version compatibility check when loading configuration files
1 parent ce10562 commit 701c57b

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Source/UI/EditorViewport.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,37 @@ const String EditorViewport::loadState (File fileToLoad)
16151615
return "Not a valid file.";
16161616
}
16171617

1618+
if (auto* element = xml->getChildByName ("INFO"))
1619+
{
1620+
for (auto* child : element->getChildIterator())
1621+
{
1622+
if (child->hasTagName ("VERSION"))
1623+
{
1624+
String savedVersion = child->getAllSubText();
1625+
String minimumVersion = "1.0.0";
1626+
1627+
if (savedVersion.compareNatural (minimumVersion) < 0)
1628+
{
1629+
bool userResponse = AlertWindow::showOkCancelBox (AlertWindow::WarningIcon,
1630+
"Incompatible Configuration File",
1631+
"This configuration file was created using a version of Open Ephys GUI older than 1.0.0. "
1632+
"Some settings and parmeters may not load correctly.\n\n"
1633+
"Would you like to proceed with loading the configuration file?",
1634+
"Yes",
1635+
"No");
1636+
1637+
if (! userResponse)
1638+
{
1639+
LOGC ("Cancelled loading configuration file.");
1640+
return "Cancelled loading configuration file.";
1641+
}
1642+
}
1643+
1644+
break;
1645+
}
1646+
}
1647+
}
1648+
16181649
AccessClass::getProcessorGraph()->getUndoManager()->beginNewTransaction ("Disabled during acquisition");
16191650

16201651
LoadSignalChain* action = new LoadSignalChain (xml);

0 commit comments

Comments
 (0)