diff --git a/nw/config.py b/nw/config.py index cd8b5c63..722f4141 100644 --- a/nw/config.py +++ b/nw/config.py @@ -317,7 +317,10 @@ class Config: return True def setLastPath(self, lastPath): - self.lastPath = path.dirname(lastPath) + if lastPath is None or lastPath == "": + self.lastPath = "" + else: + self.lastPath = path.dirname(lastPath) return True def setWinSize(self, newWidth, newHeight): diff --git a/tests/reference/novelwriter.conf b/tests/reference/novelwriter.conf index 7ea29925..90c48661 100644 --- a/tests/reference/novelwriter.conf +++ b/tests/reference/novelwriter.conf @@ -37,6 +37,7 @@ backuponclose = False askbeforebackup = True [Path] +lastpath = recent0 = recent1 = recent2 = diff --git a/tests/test_config.py b/tests/test_config.py index 12fc5c18..4c4c2523 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -14,6 +14,8 @@ def testConfigInit(nwTemp,nwRef): tmpConf = path.join(nwTemp,"novelwriter.conf") refConf = path.join(nwRef, "novelwriter.conf") assert theConf.initConfig(nwTemp) + assert theConf.setLastPath("") + assert theConf.saveConfig() assert cmpFiles(tmpConf, refConf, [2]) assert not theConf.confChanged