Do not allow restore different version

This commit is contained in:
ChrisTerBeke 2018-05-18 10:07:20 +02:00
parent 7b3f334678
commit a0d3dae920

View File

@ -14,6 +14,7 @@ from UM.Logger import Logger
from UM.Message import Message from UM.Message import Message
from UM.Platform import Platform from UM.Platform import Platform
from UM.Resources import Resources from UM.Resources import Resources
from UM.Version import Version
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
@ -116,7 +117,12 @@ class Backup:
"Tried to restore a Cura backup without having proper data or meta data.")) "Tried to restore a Cura backup without having proper data or meta data."))
return False return False
# TODO: handle restoring older data version. current_version = CuraApplication.getInstance().getVersion()
version_to_restore = self.meta_data.get("cura_release", "master")
if current_version != version_to_restore:
# Cannot restore version older or newer than current because settings might have changed.
# Restoring this will cause a lot of issues so we don't allow this for now.
return False
version_data_dir = Resources.getDataStoragePath() version_data_dir = Resources.getDataStoragePath()
archive = ZipFile(io.BytesIO(self.zip_file), "r") archive = ZipFile(io.BytesIO(self.zip_file), "r")