From 192427deaa69b460963da56c0cf0904e246b9956 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 18:55:44 +0200 Subject: [PATCH 1/7] Changed the data structure of the project folder --- nw/core/document.py | 33 ++++---------- nw/core/project.py | 102 +++++++++++++++++++++++++++++++++++++++++--- nw/core/tools.py | 7 +-- 3 files changed, 104 insertions(+), 38 deletions(-) diff --git a/nw/core/document.py b/nw/core/document.py index 4cfd09a3..a28804a9 100644 --- a/nw/core/document.py +++ b/nw/core/document.py @@ -93,8 +93,9 @@ class NWDoc(): if self.theItem.parHandle == self.theProject.projTree.trashRoot(): self.docEditable = False - docDir, docFile = self._assemblePath(self.docHandle, self.FILE_MN) - self.fileLoc = path.join(docDir,docFile) + docDir = "content" + docFile = self.docHandle+".nwd" + self.fileLoc = path.join(docDir, docFile) logger.debug("Opening document %s" % self.fileLoc) dataDir = path.join(self.theProject.projPath, docDir) docPath = path.join(dataDir, docFile) @@ -139,8 +140,9 @@ class NWDoc(): if self.docHandle is None or not self.docEditable: return False - docDir, docFile = self._assemblePath(self.docHandle, self.FILE_MN) - logger.debug("Saving document %s" % path.join(docDir,docFile)) + docDir = "content" + docFile = self.docHandle+".nwd" + logger.debug("Saving document %s" % path.join(docDir, docFile)) dataPath = path.join(self.theProject.projPath, docDir) docPath = path.join(dataPath, docFile) if not path.isdir(dataPath): @@ -159,12 +161,6 @@ class NWDoc(): self.makeAlert(["Could not save document.",str(e)], nwAlert.ERROR) return False - # Remove bak files from old file save method, if one exists - # This part can eventually be removed - docBack = path.join(dataPath, docFile[:-3]+"bak") - if path.isfile(docBack): - unlink(docBack) - # If we're here, the file was successfully saved, so we can # replace the temp file with the actual file if path.isfile(docPath): @@ -179,7 +175,8 @@ class NWDoc(): """Permanently delete a document source file and its backups from the project data folder. """ - docDir, docFile = self._assemblePath(tHandle, self.FILE_MN) + docDir = "content" + docFile = self.docHandle+".nwd" dataPath = path.join(self.theProject.projPath, docDir) chkList = [] chkList.append(path.join(dataPath, docFile)) @@ -226,18 +223,4 @@ class NWDoc(): return theMeta, thePath - ## - # Internal Functions - ## - - @staticmethod - def _assemblePath(tHandle, docExt): - """Assemble the file path for a given handle. - """ - if tHandle is None: - return None, None - docDir = "data_"+tHandle[0] - docFile = tHandle[1:13]+"_"+docExt - return docDir, docFile - # END Class NWDoc diff --git a/nw/core/project.py b/nw/core/project.py index 0c303f74..fbf04177 100644 --- a/nw/core/project.py +++ b/nw/core/project.py @@ -33,7 +33,7 @@ import logging import nw -from os import path, mkdir, listdir, unlink, rename +from os import path, mkdir, listdir, unlink, rename, rmdir from lxml import etree from hashlib import sha256 from time import time @@ -74,6 +74,7 @@ class NWProject(): # Class Settings self.projPath = None # The full path to where the currently open project is saved self.projMeta = None # The full path to the project's meta data folder + self.projData = None # The full path to the project's data folder self.projDict = None # The spell check dictionary self.projFile = None # The file name of the project main XML file @@ -195,6 +196,7 @@ class NWProject(): # Project Settings self.projPath = None self.projMeta = None + self.projData = None self.projDict = None self.projFile = nwFiles.PROJ_FILE self.projName = "" @@ -247,10 +249,13 @@ class NWProject(): logger.debug("Opening project: %s" % self.projPath) self.projMeta = path.join(self.projPath,"meta") + self.projData = path.join(self.projPath,"content") self.projDict = path.join(self.projMeta, nwFiles.PROJ_DICT) if not self._checkFolder(self.projMeta): return False + if not self._checkFolder(self.projData): + return False if overrideLock: self._clearLockFile() @@ -291,7 +296,7 @@ class NWProject(): self.clearProject() return False - xRoot = nwXML.getroot() + xRoot = nwXML.getroot() nwxRoot = xRoot.tag appVersion = "Unknown" @@ -314,13 +319,40 @@ class NWProject(): logger.verbose("XML root is %s" % nwxRoot) logger.verbose("File version is %s" % fileVersion) - if not nwxRoot == "novelWriterXML" or not fileVersion == "1.0": + # Check File Type + # =============== + if not nwxRoot == "novelWriterXML": self.makeAlert( - "Project file does not appear to be a novelWriterXML file version 1.0", + "Project file does not appear to be a novelWriterXML file.", nwAlert.ERROR ) return False + # Check Project Storage Version + # ============================= + if fileVersion == "1.0": + msgBox = QMessageBox() + msgRes = msgBox.question(self.theParent, "Old Project Version", ( + "The project file and data is created by a %s version lower than 0.7. " + "Do you want to upgrade the project to the most recent format?

" + "Note that after the upgrade, you cannot open the project with an older " + "version of novelWriter any more, so make sure you have a recent backup." + ) % nw.__package__) + if msgRes == QMessageBox.Yes: + self._updateStorage() + else: + return False + elif fileVersion != "1.1": + self.makeAlert(( + "Unknown or unsupported %s project format. " + "The project cannot be opened by this version of %s." + ) % ( + nw.__package__, nw.__package__ + ), nwAlert.ERROR) + return False + + # Check novelWriter Version + # ========================= if int(hexVersion, 16) > int(nw.__hexversion__, 16) and self.mainConf.showGUI: msgBox = QMessageBox() msgRes = msgBox.question(self.theParent, "Version Conflict", ( @@ -333,6 +365,8 @@ class NWProject(): if msgRes != QMessageBox.Yes: return False + # Start Parsing XML + # ================= for xChild in xRoot: if xChild.tag == "project": logger.debug("Found project meta") @@ -404,16 +438,21 @@ class NWProject(): file. """ if self.projPath is None: - self.makeAlert("Project path not set, cannot save.", nwAlert.ERROR) + self.makeAlert( + "Project path not set, cannot save project.", nwAlert.ERROR + ) return False - self.projMeta = path.join(self.projPath,"meta") + self.projMeta = path.join(self.projPath, "meta") + self.projData = path.join(self.projPath, "content") saveTime = time() if not self._checkFolder(self.projPath): return False if not self._checkFolder(self.projMeta): return False + if not self._checkFolder(self.projData): + return False logger.debug("Saving project: %s" % self.projPath) @@ -427,7 +466,7 @@ class NWProject(): nwXML = etree.Element("novelWriterXML",attrib={ "appVersion" : str(nw.__version__), "hexVersion" : str(nw.__hexversion__), - "fileVersion" : "1.0", + "fileVersion" : "1.1", "saveCount" : str(self.saveCount), "autoCount" : str(self.autoCount), "timeStamp" : formatTimeStamp(saveTime), @@ -1016,6 +1055,55 @@ class NWProject(): return True + def _updateStorage(self): + """Updates the project storage folder from 1.0 to 1.1. + """ + contDir = path.join(self.projPath, "content") + self._checkFolder(contDir) + errList = [] + + for projItem in listdir(self.projPath): + itemPath = path.join(self.projPath, projItem) + if not path.isdir(itemPath) or not projItem.startswith("data_"): + continue + for dataFile in listdir(itemPath): + dataPath = path.join(itemPath, dataFile) + if dataFile.endswith(".bak"): + try: + unlink(dataPath) + logger.info("Deleted file: %s" % dataPath) + except: + errList.append("Failed to delete: %s" % dataPath) + + elif dataFile.endswith(".nwd") and len(dataFile) == 21: + tHandle = projItem[-1]+dataFile[:12] + newPath = path.join(contDir, tHandle+".nwd") + try: + rename(dataPath, newPath) + logger.info("Moved file: %s" % dataPath) + logger.info("New location: %s" % newPath) + except: + errList.append("Failed to move: %s" % dataPath) + + else: + newPath = path.join(self.projPath, "unknown_"+dataFile) + try: + rename(dataPath, newPath) + logger.info("Moved file: %s" % dataPath) + logger.info("New location: %s" % newPath) + except: + errList.append("Failed to move: %s" % dataPath) + try: + rmdir(itemPath) + logger.info("Removed folder: %s" % itemPath) + except: + errList.append("Failed to delete: %s" % itemPath) + + if errList: + self.makeAlert(errList, nwAlert.ERROR) + + return + # END Class NWProject # ================================================================================================ # diff --git a/nw/core/tools.py b/nw/core/tools.py index a6eb244b..8aa81d7b 100644 --- a/nw/core/tools.py +++ b/nw/core/tools.py @@ -89,7 +89,7 @@ def projectMaintenance(theProject): if path.isdir(theProject.projPath): cacheDir = path.join(theProject.projPath, "cache") if path.isdir(cacheDir): - logger.info("Deprecated cache folder found") + logger.info("Deprecated cache folder content found") rmList = [] for i in range(10): rmList.append(path.join(cacheDir, "nwProject.nwx.%d" % i)) @@ -101,11 +101,6 @@ def projectMaintenance(theProject): unlink(rmFile) except Exception as e: logger.error(str(e)) - logger.info("Deleting: %s" % cacheDir) - try: - rmdir(cacheDir) - except Exception as e: - logger.error(str(e)) # Remove no longer used meta files rmList = [] From 6fac354f691cceb1d011cfec3f6186babde9a4a0 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 18:56:58 +0200 Subject: [PATCH 2/7] Added the converted sample project --- .../{data_1/4298de4d9524_main.nwd => content/14298de4d9524.nwd} | 0 .../{data_5/3b69b83cdafc_main.nwd => content/53b69b83cdafc.nwd} | 0 .../{data_5/eaea4e8cdee8_main.nwd => content/5eaea4e8cdee8.nwd} | 0 .../{data_6/36b6aa9b697b_main.nwd => content/636b6aa9b697b.nwd} | 0 .../{data_6/a2d6d5f4f401_main.nwd => content/6a2d6d5f4f401.nwd} | 0 .../{data_8/8706ddc78b1b_main.nwd => content/88706ddc78b1b.nwd} | 0 .../{data_9/6b68994dfa3d_main.nwd => content/96b68994dfa3d.nwd} | 0 .../{data_9/74e400180a99_main.nwd => content/974e400180a99.nwd} | 0 .../{data_a/e7339df26ded_main.nwd => content/ae7339df26ded.nwd} | 0 .../{data_b/3e74dbc1f584_main.nwd => content/b3e74dbc1f584.nwd} | 0 .../{data_b/8136a5a774a0_main.nwd => content/b8136a5a774a0.nwd} | 0 .../{data_b/a8a28a246524_main.nwd => content/ba8a28a246524.nwd} | 0 .../{data_b/b2c23b3c42cc_main.nwd => content/bb2c23b3c42cc.nwd} | 0 .../{data_b/c0cbd2a407f3_main.nwd => content/bc0cbd2a407f3.nwd} | 0 .../{data_e/dca4be2fcaf8_main.nwd => content/edca4be2fcaf8.nwd} | 0 .../{data_f/1471bef9f2ae_main.nwd => content/f1471bef9f2ae.nwd} | 0 sample/nwProject.nwx | 2 +- 17 files changed, 1 insertion(+), 1 deletion(-) rename sample/{data_1/4298de4d9524_main.nwd => content/14298de4d9524.nwd} (100%) rename sample/{data_5/3b69b83cdafc_main.nwd => content/53b69b83cdafc.nwd} (100%) rename sample/{data_5/eaea4e8cdee8_main.nwd => content/5eaea4e8cdee8.nwd} (100%) rename sample/{data_6/36b6aa9b697b_main.nwd => content/636b6aa9b697b.nwd} (100%) rename sample/{data_6/a2d6d5f4f401_main.nwd => content/6a2d6d5f4f401.nwd} (100%) rename sample/{data_8/8706ddc78b1b_main.nwd => content/88706ddc78b1b.nwd} (100%) rename sample/{data_9/6b68994dfa3d_main.nwd => content/96b68994dfa3d.nwd} (100%) rename sample/{data_9/74e400180a99_main.nwd => content/974e400180a99.nwd} (100%) rename sample/{data_a/e7339df26ded_main.nwd => content/ae7339df26ded.nwd} (100%) rename sample/{data_b/3e74dbc1f584_main.nwd => content/b3e74dbc1f584.nwd} (100%) rename sample/{data_b/8136a5a774a0_main.nwd => content/b8136a5a774a0.nwd} (100%) rename sample/{data_b/a8a28a246524_main.nwd => content/ba8a28a246524.nwd} (100%) rename sample/{data_b/b2c23b3c42cc_main.nwd => content/bb2c23b3c42cc.nwd} (100%) rename sample/{data_b/c0cbd2a407f3_main.nwd => content/bc0cbd2a407f3.nwd} (100%) rename sample/{data_e/dca4be2fcaf8_main.nwd => content/edca4be2fcaf8.nwd} (100%) rename sample/{data_f/1471bef9f2ae_main.nwd => content/f1471bef9f2ae.nwd} (100%) diff --git a/sample/data_1/4298de4d9524_main.nwd b/sample/content/14298de4d9524.nwd similarity index 100% rename from sample/data_1/4298de4d9524_main.nwd rename to sample/content/14298de4d9524.nwd diff --git a/sample/data_5/3b69b83cdafc_main.nwd b/sample/content/53b69b83cdafc.nwd similarity index 100% rename from sample/data_5/3b69b83cdafc_main.nwd rename to sample/content/53b69b83cdafc.nwd diff --git a/sample/data_5/eaea4e8cdee8_main.nwd b/sample/content/5eaea4e8cdee8.nwd similarity index 100% rename from sample/data_5/eaea4e8cdee8_main.nwd rename to sample/content/5eaea4e8cdee8.nwd diff --git a/sample/data_6/36b6aa9b697b_main.nwd b/sample/content/636b6aa9b697b.nwd similarity index 100% rename from sample/data_6/36b6aa9b697b_main.nwd rename to sample/content/636b6aa9b697b.nwd diff --git a/sample/data_6/a2d6d5f4f401_main.nwd b/sample/content/6a2d6d5f4f401.nwd similarity index 100% rename from sample/data_6/a2d6d5f4f401_main.nwd rename to sample/content/6a2d6d5f4f401.nwd diff --git a/sample/data_8/8706ddc78b1b_main.nwd b/sample/content/88706ddc78b1b.nwd similarity index 100% rename from sample/data_8/8706ddc78b1b_main.nwd rename to sample/content/88706ddc78b1b.nwd diff --git a/sample/data_9/6b68994dfa3d_main.nwd b/sample/content/96b68994dfa3d.nwd similarity index 100% rename from sample/data_9/6b68994dfa3d_main.nwd rename to sample/content/96b68994dfa3d.nwd diff --git a/sample/data_9/74e400180a99_main.nwd b/sample/content/974e400180a99.nwd similarity index 100% rename from sample/data_9/74e400180a99_main.nwd rename to sample/content/974e400180a99.nwd diff --git a/sample/data_a/e7339df26ded_main.nwd b/sample/content/ae7339df26ded.nwd similarity index 100% rename from sample/data_a/e7339df26ded_main.nwd rename to sample/content/ae7339df26ded.nwd diff --git a/sample/data_b/3e74dbc1f584_main.nwd b/sample/content/b3e74dbc1f584.nwd similarity index 100% rename from sample/data_b/3e74dbc1f584_main.nwd rename to sample/content/b3e74dbc1f584.nwd diff --git a/sample/data_b/8136a5a774a0_main.nwd b/sample/content/b8136a5a774a0.nwd similarity index 100% rename from sample/data_b/8136a5a774a0_main.nwd rename to sample/content/b8136a5a774a0.nwd diff --git a/sample/data_b/a8a28a246524_main.nwd b/sample/content/ba8a28a246524.nwd similarity index 100% rename from sample/data_b/a8a28a246524_main.nwd rename to sample/content/ba8a28a246524.nwd diff --git a/sample/data_b/b2c23b3c42cc_main.nwd b/sample/content/bb2c23b3c42cc.nwd similarity index 100% rename from sample/data_b/b2c23b3c42cc_main.nwd rename to sample/content/bb2c23b3c42cc.nwd diff --git a/sample/data_b/c0cbd2a407f3_main.nwd b/sample/content/bc0cbd2a407f3.nwd similarity index 100% rename from sample/data_b/c0cbd2a407f3_main.nwd rename to sample/content/bc0cbd2a407f3.nwd diff --git a/sample/data_e/dca4be2fcaf8_main.nwd b/sample/content/edca4be2fcaf8.nwd similarity index 100% rename from sample/data_e/dca4be2fcaf8_main.nwd rename to sample/content/edca4be2fcaf8.nwd diff --git a/sample/data_f/1471bef9f2ae_main.nwd b/sample/content/f1471bef9f2ae.nwd similarity index 100% rename from sample/data_f/1471bef9f2ae_main.nwd rename to sample/content/f1471bef9f2ae.nwd diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 481ef3c1..5c33e33c 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project From 7373f9636b56d411c22ca04abf65977661076a3c Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 19:03:59 +0200 Subject: [PATCH 3/7] Updated orphan file check --- nw/core/project.py | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/nw/core/project.py b/nw/core/project.py index fbf04177..96e22103 100644 --- a/nw/core/project.py +++ b/nw/core/project.py @@ -976,29 +976,20 @@ class NWProject(): if self.projPath is None: return - # First, scan the project data folders - itemList = [] - for subItem in listdir(self.projPath): - if subItem[:5] != "data_": - continue - dataDir = path.join(self.projPath,subItem) - for subFile in listdir(dataDir): - if subFile[-4:] == ".nwd": - newItem = path.join(subItem,subFile) - itemList.append(newItem) - - # Then check the valid files + # Then check the files in the data folder orphanFiles = [] - for fileItem in itemList: - if len(fileItem) != 28: - # Just to be safe, shouldn't happen + for fileItem in listdir(self.projData): + if not fileItem.endswith(".nwd"): logger.warning("Skipping file %s" % fileItem) continue - fHandle = fileItem[5]+fileItem[7:19] + if len(fileItem) != 17: + logger.warning("Skipping file %s" % fileItem) + continue + fHandle = fileItem[:13] if fHandle in self.projTree: - logger.debug("Checking file %s, handle %s: OK" % (fileItem,fHandle)) + logger.debug("Checking file %s, handle %s: OK" % (fileItem, fHandle)) else: - logger.debug("Checking file %s, handle %s: Orphaned" % (fileItem,fHandle)) + logger.debug("Checking file %s, handle %s: Orphaned" % (fileItem, fHandle)) orphanFiles.append(fHandle) # Report status From 18132277c31dd69ae5b8d457b6040aa50ecd5e0c Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 19:10:33 +0200 Subject: [PATCH 4/7] Fixed tests --- ...e17daca5f3e1_main.nwd => 1_0e17daca5f3e1.nwd} | 0 ...a6562590ef19_main.nwd => 1_1a6562590ef19.nwd} | 0 ...1489056e0916_main.nwd => 1_31489056e0916.nwd} | 0 ...8010bd9270f9_main.nwd => 1_98010bd9270f9.nwd} | 0 tests/test_gui.py | 16 ++++++++-------- 5 files changed, 8 insertions(+), 8 deletions(-) rename tests/reference/gui/{1_e17daca5f3e1_main.nwd => 1_0e17daca5f3e1.nwd} (100%) rename tests/reference/gui/{1_a6562590ef19_main.nwd => 1_1a6562590ef19.nwd} (100%) rename tests/reference/gui/{1_1489056e0916_main.nwd => 1_31489056e0916.nwd} (100%) rename tests/reference/gui/{1_8010bd9270f9_main.nwd => 1_98010bd9270f9.nwd} (100%) diff --git a/tests/reference/gui/1_e17daca5f3e1_main.nwd b/tests/reference/gui/1_0e17daca5f3e1.nwd similarity index 100% rename from tests/reference/gui/1_e17daca5f3e1_main.nwd rename to tests/reference/gui/1_0e17daca5f3e1.nwd diff --git a/tests/reference/gui/1_a6562590ef19_main.nwd b/tests/reference/gui/1_1a6562590ef19.nwd similarity index 100% rename from tests/reference/gui/1_a6562590ef19_main.nwd rename to tests/reference/gui/1_1a6562590ef19.nwd diff --git a/tests/reference/gui/1_1489056e0916_main.nwd b/tests/reference/gui/1_31489056e0916.nwd similarity index 100% rename from tests/reference/gui/1_1489056e0916_main.nwd rename to tests/reference/gui/1_31489056e0916.nwd diff --git a/tests/reference/gui/1_8010bd9270f9_main.nwd b/tests/reference/gui/1_98010bd9270f9.nwd similarity index 100% rename from tests/reference/gui/1_8010bd9270f9_main.nwd rename to tests/reference/gui/1_98010bd9270f9.nwd diff --git a/tests/test_gui.py b/tests/test_gui.py index 47432f51..3d202b18 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -237,14 +237,14 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp): # Check the files refFile = path.join(nwTempGUI,"nwProject.nwx") assert cmpFiles(refFile, path.join(nwRef,"gui","1_nwProject.nwx"), [2]) - refFile = path.join(nwTempGUI,"data_0","e17daca5f3e1_main.nwd") - assert cmpFiles(refFile, path.join(nwRef,"gui","1_e17daca5f3e1_main.nwd")) - refFile = path.join(nwTempGUI,"data_9","8010bd9270f9_main.nwd") - assert cmpFiles(refFile, path.join(nwRef,"gui","1_8010bd9270f9_main.nwd")) - refFile = path.join(nwTempGUI,"data_3","1489056e0916_main.nwd") - assert cmpFiles(refFile, path.join(nwRef,"gui","1_1489056e0916_main.nwd")) - refFile = path.join(nwTempGUI,"data_1","a6562590ef19_main.nwd") - assert cmpFiles(refFile, path.join(nwRef,"gui","1_a6562590ef19_main.nwd")) + refFile = path.join(nwTempGUI,"content","0e17daca5f3e1.nwd") + assert cmpFiles(refFile, path.join(nwRef,"gui","1_0e17daca5f3e1.nwd")) + refFile = path.join(nwTempGUI,"content","98010bd9270f9.nwd") + assert cmpFiles(refFile, path.join(nwRef,"gui","1_98010bd9270f9.nwd")) + refFile = path.join(nwTempGUI,"content","31489056e0916.nwd") + assert cmpFiles(refFile, path.join(nwRef,"gui","1_31489056e0916.nwd")) + refFile = path.join(nwTempGUI,"content","1a6562590ef19.nwd") + assert cmpFiles(refFile, path.join(nwRef,"gui","1_1a6562590ef19.nwd")) nwGUI.closeMain() # qtbot.stopForInteraction() From bdbfa1d3c333e13aefdf8c72a2199159614674f0 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 19:13:51 +0200 Subject: [PATCH 5/7] Some more cleanup --- nw/core/document.py | 2 -- sample/nwProject.nwx | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/nw/core/document.py b/nw/core/document.py index a28804a9..7ce4de4e 100644 --- a/nw/core/document.py +++ b/nw/core/document.py @@ -37,8 +37,6 @@ logger = logging.getLogger(__name__) class NWDoc(): - FILE_MN = "main.nwd" - def __init__(self, theProject, theParent): self.mainConf = nw.CONFIG diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 5c33e33c..f1d9840c 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -12,7 +12,7 @@ True 636b6aa9b697b ba8a28a246524 - 920 + 914 B E @@ -290,9 +290,9 @@ False True SCENE - 30 - 6 - 1 + 0 + 0 + 0 36 From f7fb98cde5c99849a7735b091359efb4c521954e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 19:23:00 +0200 Subject: [PATCH 6/7] Updated changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56c45a0c..dfd9e8cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Version 0.7 [2020-xx-xx] +**Project Structure** + +* The project folder structure has been simplified and cleaned up. We also now pin the main entry values in the main XML file. the XML file is now given version 1.1, and locking it to only be opened by version 0.7 or later. The project is converted on first open, if the user approves. PR #253. + **Other Changes** * Dropped the usage of .bak copies of document files. This was the old method to ensure the document data was written successfully, but it uses twice the storage space. Instead, writing via a temp file is the safe way to save files. PR #248. From 7b15dc78673b7f696a1d132f2834f64de7392d59 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 19:25:57 +0200 Subject: [PATCH 7/7] Updated technical docs --- docs/source/technical.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/technical.rst b/docs/source/technical.rst index 32d79545..027d2aaf 100644 --- a/docs/source/technical.rst +++ b/docs/source/technical.rst @@ -30,9 +30,9 @@ The project XML file is indent-formatted, suitable for diff tools and version co Project Documents ----------------- -The project documents are saved in folders starting with ``data_``. +The project documents are saved in a folder in the main project folder named ``content``. Each document has a file handle taken from the first 13 characters of a SHA256 hash of the system time when the file was first created. -The documents are saved with a folder and filename derived from this hash. +The documents are saved with a filename assembled from this hash and the file extension ``.nwd``. If you wish to find the physical location of a file in the project, you can either look it up in the project XML file, or select :menuselection:`Document --> Show File Details` in the menu when having the document open. The reason for this cryptic file naming is to avoid issues with file naming conventions and restrictions on different operating systems, and also to have a file name that does not depend on what the user names the files, or changes it to.