macOS: Add app bundle support with runtime data directory resolution#217
Draft
edjw wants to merge 2 commits intodagargo:masterfrom
Draft
macOS: Add app bundle support with runtime data directory resolution#217edjw wants to merge 2 commits intodagargo:masterfrom
edjw wants to merge 2 commits intodagargo:masterfrom
Conversation
Previously, DATADIR was hardcoded at compile time, which meant the binary could only find its resources (UI files, CSS, device configs) at the path baked in by ./configure. This prevents packaging as a macOS .app bundle, since bundles can be placed anywhere on disk. Add get_data_dir() which uses _NSGetExecutablePath() on macOS to locate the executable and resolve the data directory relative to the bundle structure (../Resources/share/elektroid). Falls back to the compile-time DATADIR if not running from a bundle or on other platforms — no change in behaviour for Linux. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Script to package Elektroid as a macOS .app with proper icon, Info.plist, and bundled resources. Requires rsvg-convert for icon generation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
This is really cool! Thanks for improving Elektroid support on OSX. I'll review this carefully and merge it this during the following days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Elektroid has no macOS app bundle support. On macOS you can build from source and run the binary, but there's no way to package it as a
.appin/Applications— becauseDATADIRis hardcoded at compile time to wherever./configurepointed. Move the binary anywhere else and it can't find its UI files, CSS, or device configs.Solution
Runtime data directory resolution — a new
get_data_dir()function that, on macOS, uses_NSGetExecutablePath()to find the executable's actual location and resolves the data directory relative to the bundle structure (../Resources/share/elektroid). If it's not running from a bundle, or on any other platform, it falls back to the compile-timeDATADIR. Zero change in behaviour for Linux.All 7
DATADIRstring literal usages across 4 files are replaced withg_build_filename(get_data_dir(), ...)calls.Also includes
macos-bundle.sh, a script to package a build into a proper.appwith icon generation,Info.plist, and bundled resources.Changes
src/utils.c/src/utils.h— newget_data_dir()functionsrc/elektroid.c— 4 usages updatedsrc/connectors/elektron.c— 1 usage updatedsrc/connectors/volca_sample_2.c— 1 usage updatedsrc/mactions/microbrute.c— 1 usage updatedmacos-bundle.sh— app bundle build script.gitignore— ignore generatedElektroid.app/Test plan
get_data_dir()compiles toreturn DATADIR).appbundle in/Applications🤖 Generated with Claude Code