Skip to content

Commit

Permalink
Adjust data locations for macOS app bundle
Browse files Browse the repository at this point in the history
The application bundle is relocatable, so the data locations must be
set at runtime.
  • Loading branch information
dehesselle committed Dec 28, 2024
1 parent d327bc4 commit abf00be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ macos:
variables:
CCACHE_DIR: /Users/Shared/work/ccache
MM_REPO_URL: https://gitlab.com/dehesselle/meld_macos.git
MM_REPO_REF: 40a3e6b090650de6fcf3e684fc7dac527b4e9310
MM_REPO_REF: cf0d881d2bfdc1607f0e2bd11bcd9bd215e74f1b
MELD_BUILD: $CI_PIPELINE_IID
REP_DIR: $CI_PROJECT_DIR
SDKROOT: /opt/sdks/MacOSX11.3.sdk
Expand Down
18 changes: 18 additions & 0 deletions bin/meld
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,23 @@ def setup_glib_logging():
pass


def setup_macos_application_bundle():
# When running from inside an application bundle, adjust paths relative
# to the location of the main binary.
if "Contents/MacOS" in sys.executable:
meld.conf.DATADIR = os.path.abspath(
os.path.join(
os.path.dirname(os.path.realpath(sys.executable)),
"../Resources/share/meld"
)
)
meld.conf.LOCALEDIR = os.path.abspath(
os.path.join(
os.path.dirname(meld.conf.DATADIR), "locale"
)
)


def environment_hacks():
# MSYSTEM is set by git, and confuses our
# msys-packaged version's library search path -
Expand Down Expand Up @@ -449,6 +466,7 @@ def run_application():


def main():
setup_macos_application_bundle()
environment_hacks()
setup_logging()
disable_stdout_buffering()
Expand Down

0 comments on commit abf00be

Please sign in to comment.