andlabs / andlabs/libui

How to make ui executable a double clickable Mac app

Offen
#474 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C
Sterne
10.9k
Forks
612
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

To make a "Double Clickable" Application for the Finder from an executable compiled with libui, one needs only to put the ui_executable in the correct directory structure:
|--- ui_executable.app
|------ Contents
|--------- MacOS
|------------ ui_executable
|--------- PkgInfo

The attached bash script will do that. It has been tested with your examples.

[makeapp.zip](https://github.com/andlabs/libui/files/3676999/makeapp.zip)
```
#!/bin/bash
#├── $1.app
#│   └── Contents
#│   ├── MacOS
#│   │   └── $1
#│   └── PkgInfo

if [ -z "$1" ]; then
_self="${0##*/}"
echo "Usage: $_self "
exit 0;
fi

mkdir -p "$1.app/Contents/MacOS"
mv "$1" "$1.app/Contents/MacOS/"
echo 'APPL????' > "$1.app/Contents/PkgInfo"

# Info.plist is optional
# change copyright for "Get Info" in Finder
copyright="$(id -F) License"
cat > "$1.app/Contents/Info.plist" <<- EOM

CFBundleExecutable
$1
CFBundleIdentifier
com.uiLib.$1
CFBundleInfoDictionaryVersion
6.0
CFBundleName
$1
CFBundlePackageType
APPL
CFBundleShortVersionString
1.0
CFBundleSupportedPlatforms

MacOSX

CFBundleVersion
1
NSHumanReadableCopyright
$copyright

EOM

# touch is important for Finder
touch "$1.app"
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.