diff --git a/nw/constants.py b/nw/constants.py index 92c693dc..51bde4e5 100644 --- a/nw/constants.py +++ b/nw/constants.py @@ -22,6 +22,7 @@ class nwFiles(): APP_ICON = "novelWriter.svg" PROJ_FILE = "nwProject.nwx" + PROJ_COUNT = "projCount.txt" PROJ_DICT = "wordlist.txt" SESS_INFO = "sessionInfo.log" INDEX_FILE = "tagsIndex.json" diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index ec9635db..872e9c66 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -611,7 +611,7 @@ class GuiMain(QMainWindow): """ if isinstance(theMessage, list): - popMsg = "
".join(theMessage) + popMsg = " ".join(theMessage) logMsg = theMessage else: popMsg = theMessage diff --git a/nw/project/project.py b/nw/project/project.py index 23e46e9e..00f31177 100644 --- a/nw/project/project.py +++ b/nw/project/project.py @@ -197,10 +197,15 @@ class NWProject(): if not self._checkFolder(self.projMeta): return if not self._checkFolder(self.projCache): return - nwXML = etree.parse(fileName) - xRoot = nwXML.getroot() + try: + nwXML = etree.parse(fileName) + except Exception as e: + self.makeAlert(["Failed to parse project xml.",str(e)], nwAlert.ERROR) + return False + + xRoot = nwXML.getroot() + nwxRoot = xRoot.tag - nwxRoot = xRoot.tag appVersion = xRoot.attrib["appVersion"] fileVersion = xRoot.attrib["fileVersion"] @@ -709,7 +714,7 @@ class NWProject(): file gets corrupted. """ - countFile = path.join(self.projCache, "projCount.txt") + countFile = path.join(self.projCache, nwFiles.PROJ_COUNT) projCount = 0 if path.isfile(countFile): @@ -718,7 +723,7 @@ class NWProject(): projCount = int(inFile.read())+1 except: projCount = 0 - + if projCount > 9: projCount = 0