From 5a0ba544546416228f309d9dc422951dc7c31889 Mon Sep 17 00:00:00 2001 From: python357-1 <30739625+python357-1@users.noreply.github.com> Date: Wed, 1 Jan 2025 04:35:35 -0600 Subject: [PATCH] fix: strip whitespace around --open/-o flag (#670) * fix: fix -o flag not working if path has whitespace around it * fix: change strip to lstrip/rstrip * fix: manually expand "~" --- tagstudio/src/core/driver.py | 2 +- tagstudio/src/qt/ts_qt.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tagstudio/src/core/driver.py b/tagstudio/src/core/driver.py index 1561fbc9..1f7dd4f7 100644 --- a/tagstudio/src/core/driver.py +++ b/tagstudio/src/core/driver.py @@ -16,7 +16,7 @@ class DriverMixin: """Check if the path of library is valid.""" library_path: Path | None = None if open_path: - library_path = Path(open_path) + library_path = Path(open_path).expanduser() if not library_path.exists(): logger.error("Path does not exist.", open_path=open_path) return LibraryStatus(success=False, message="Path does not exist.") diff --git a/tagstudio/src/qt/ts_qt.py b/tagstudio/src/qt/ts_qt.py index 06c136dc..986d7120 100644 --- a/tagstudio/src/qt/ts_qt.py +++ b/tagstudio/src/qt/ts_qt.py @@ -496,7 +496,7 @@ class QtDriver(DriverMixin, QObject): self.init_library_window() self.migration_modal: JsonMigrationModal = None - path_result = self.evaluate_path(self.args.open) + path_result = self.evaluate_path(str(self.args.open).lstrip().rstrip()) # check status of library path evaluating if path_result.success and path_result.library_path: self.splash.showMessage(