From cdc85b91e851518bd23571b5e7589795214a5535 Mon Sep 17 00:00:00 2001 From: Michael Lass Date: Wed, 30 Sep 2020 20:23:56 +0200 Subject: [PATCH] Fix locating jabref in jabrefHost.py shutil.which() returns an str and not a pathlib.Path. Therefore, we need to check if which() actually returns something and if so, we should convert it to a pathlib.Path such that JABREF_PATH is always of the same type. Also, try locating JabRef in addition to jabref in the user's PATH. --- CHANGELOG.md | 1 + buildres/linux/jabrefHost.py | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ef2a053543d..4279e2777541 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where no longer a warning was displayed when inserting references into LibreOffice with an invalid "ReferenceParagraphFormat". [#6907](https://github.com/JabRef/jabref/pull/60907). - We fixed an issue where a selected field was not removed after the first click in the custom entry types dialog [#6934](https://github.com/JabRef/jabref/issues/6934) - We fixed an issue where a remove icon was shown for standard entry types in the custom entry types dialog [6906](https://github.com/JabRef/jabref/issues/6906) +- We fixed an issue with the python script used by browser plugins that failed to locate JabRef if not installed in its default location. ### Removed diff --git a/buildres/linux/jabrefHost.py b/buildres/linux/jabrefHost.py index e1343e232074..73fa31536f1a 100755 --- a/buildres/linux/jabrefHost.py +++ b/buildres/linux/jabrefHost.py @@ -19,10 +19,12 @@ JABREF_PATH = script_dir / "bin/JabRef" if not JABREF_PATH.exists(): JABREF_PATH = shutil.which("jabref") - -if not JABREF_PATH.exists(): - logging.error("Could not determine JABREF_PATH") - sys.exit(-1) + if not JABREF_PATH: + JABREF_PATH = shutil.which("JabRef") + if not JABREF_PATH: + logging.error("Could not determine JABREF_PATH") + sys.exit(-1) + JABREF_PATH = Path(JABREF_PATH) logging_dir = Path.home() / ".mozilla/native-messaging-hosts/" if not logging_dir.exists():