From a3381f1f796951193e4c251d07060937b20a767d Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:23:42 +0200 Subject: [PATCH] Remove fallback parameter for lastPath and remove commented out code --- novelwriter/config.py | 4 ++-- novelwriter/tools/welcome.py | 2 +- tests/conftest.py | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/novelwriter/config.py b/novelwriter/config.py index fa12ac07..d122a0b1 100644 --- a/novelwriter/config.py +++ b/novelwriter/config.py @@ -438,9 +438,9 @@ class Config: return self._appPath / "assets" / target return self._appPath / "assets" - def lastPath(self, key: str | None = None) -> Path: + def lastPath(self, key: str) -> Path: """Return the last path used by the user, if it exists.""" - if path := self._recentPaths.getPath(key or "default"): + if path := self._recentPaths.getPath(key): asPath = Path(path) if asPath.is_dir(): return asPath diff --git a/novelwriter/tools/welcome.py b/novelwriter/tools/welcome.py index c2c516bf..b962e98c 100644 --- a/novelwriter/tools/welcome.py +++ b/novelwriter/tools/welcome.py @@ -220,7 +220,7 @@ class GuiWelcome(NDialog): @pyqtSlot() def _browseForProject(self) -> None: """Browse for a project to open.""" - if path := SHARED.getProjectPath(self, path=CONFIG.lastPath("project"), allowZip=False): + if path := SHARED.getProjectPath(self, path=CONFIG.homePath(), allowZip=False): self._openProjectPath(path) return diff --git a/tests/conftest.py b/tests/conftest.py index a4bc9ce9..c8abbfda 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -50,7 +50,6 @@ def resetConfigVars(): """Reset the CONFIG object and set various values for testing to prevent interfering with local OS. """ - # CONFIG.setLastPath(_TMP_ROOT) CONFIG.setBackupPath(_TMP_ROOT) CONFIG.setGuiFont(None) CONFIG.setTextFont(None)