andlabs / andlabs/libui

How to make ui executable a double clickable Mac app

未关闭
#474 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C
星标
10.9k
派生
612
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。