andlabs / andlabs/libui

How to make ui executable a double clickable Mac app

Aperta
#474 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C
Stelle
10.9k
Fork
612
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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"
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.