Workspace reader now does a pre-check to see if it's a workspace in the first place

CURA-1263
This commit is contained in:
Jaime van Kessel 2016-11-16 16:04:03 +01:00
parent 42be3c7472
commit 9f27e7861f

View File

@ -99,6 +99,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if quality_changes[0] != instance_container:
quality_changes_conflict = True
break
try:
archive.open("Cura/preferences.cfg")
except KeyError:
# If there is no preferences file, it's not a workspace, so notify user of failure.
Logger.log("w", "File %s is not a valid workspace.", file_name)
return WorkspaceReader.PreReadResult.failed
if machine_conflict or quality_changes_conflict or material_conflict:
# There is a conflict; User should choose to either update the existing data, add everything as new data or abort