From cba7de3c732b16136cd6311bd2f9fcfcf6c371c2 Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Mon, 6 Apr 2020 15:19:14 +0200 Subject: [PATCH] PICARD-1763: Ensure macOS working dir is not the app dir\n\nAvoids crashes on startup --- scripts/pyinstaller/macos-library-path-hook.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/pyinstaller/macos-library-path-hook.py b/scripts/pyinstaller/macos-library-path-hook.py index 546b36565..1f717272d 100644 --- a/scripts/pyinstaller/macos-library-path-hook.py +++ b/scripts/pyinstaller/macos-library-path-hook.py @@ -23,6 +23,9 @@ import os import sys +# The macOS app crashes on launch if the working directory happens to be sys._MEIPASS +os.chdir(os.path.abspath(os.path.join(sys._MEIPASS, '..', '..'))) + # On macOS ensure libraries such as libdiscid.dylib get loaded from app bundle os.environ['DYLD_FALLBACK_LIBRARY_PATH'] = '%s:%s' % ( os.path.dirname(sys.executable), os.environ.get('DYLD_FALLBACK_LIBRARY_PATH', ''))