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 "~"
This commit is contained in:
python357-1
2025-01-01 04:35:35 -06:00
committed by GitHub
parent d948c0ce4c
commit 5a0ba54454
2 changed files with 2 additions and 2 deletions

View File

@@ -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.")

View File

@@ -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(