From 1b773c1b44ef437d3f609c351bd1601acefb2674 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 27 Jun 2020 17:20:47 +0200 Subject: [PATCH] Bump the version of the project XML file to prevent data loss if going back to an older version of novelWriter --- nw/core/project.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/nw/core/project.py b/nw/core/project.py index 6b17b51a..1a0a035e 100644 --- a/nw/core/project.py +++ b/nw/core/project.py @@ -356,6 +356,15 @@ class NWProject(): # Check Project Storage Version # ============================= + # Changes: + # 1.0 : Original file format. + # 1.1 : Changes the way documents are structure in the project + # folder from data_X, where X is the first hex value of + # the handle, to a single content folder. + # 1.2 : Changes the way autoReplace entries are stored. The 1.1 + # parser will lose the autoReplace settings if allowed to + # read the file. Introduced in version 0.10. + if fileVersion == "1.0": msgBox = QMessageBox() msgRes = msgBox.question(self.theParent, "Old Project Version", ( @@ -369,10 +378,10 @@ class NWProject(): if msgRes != QMessageBox.Yes: return False - elif fileVersion != "1.1": + elif fileVersion != "1.1" and fileVersion != "1.2": self.makeAlert(( - "Unknown or unsupported %s project format. " - "The project cannot be opened by this version of %s." + "Unknown or unsupported %s project file format. " + "The project cannot be opened by this version of %s. " ) % ( nw.__package__, nw.__package__ ), nwAlert.ERROR) @@ -512,7 +521,7 @@ class NWProject(): nwXML = etree.Element("novelWriterXML", attrib={ "appVersion" : str(nw.__version__), "hexVersion" : str(nw.__hexversion__), - "fileVersion" : "1.1", + "fileVersion" : "1.2", "timeStamp" : formatTimeStamp(saveTime), })