Skip to content

Commit

Permalink
Update MacOS jabrefHost.py to find local installs (JabRef#9487)
Browse files Browse the repository at this point in the history
Following issue [9474](JabRef#9474).

The previous MacOS hardcoded path fails if JabRef is installed to a users local applications directory rather than the system one (e.g. if the user doesn't have admin permissions). On my version of MacOS (12.6.1) this change works correctly for local installs as well. The Mac app bundle is structured differently so an alternate path is still required.

If the difference in `which` behaviour is still a problem (maybe on older versions?) the original hardcoded fallback could also be included as a final option. If that is still necessary the explanatory comment should be updated too.

As mentioned on the issue thread the python script path in the browser extension JSON would still need to be updated for local installs, so I will submit a separate PR to the docs with notes on the process. If this script can't be updated I can expand the docs update to detail the hardcoded path change required to make the browser extension work for local app installs.
  • Loading branch information
allydunham authored Dec 21, 2022
1 parent 5c9df5a commit 69d504a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions buildres/mac/jabrefHost.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
from pathlib import Path

# We assume that this python script is located in "jabref/lib" while the executable is "jabref/bin/JabRef"
# Note that the `which` command does not work as intended on MacOs, so the path must be hardcoded.
# Note that the package structure is different when installed as a .app bundle on MacOs, so the path must be altered.
script_dir = Path(__file__).resolve().parent.parent
JABREF_PATH = script_dir / "bin/JabRef"
if not JABREF_PATH.exists():
JABREF_PATH = Path( "/Applications/JabRef.app/Contents/MacOS/JabRef")
JABREF_PATH = script_dir / "MacOS/JabRef"

if not JABREF_PATH.exists():
logging.error("Could not determine JABREF_PATH")
Expand Down

0 comments on commit 69d504a

Please sign in to comment.