-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·31 lines (25 loc) · 731 Bytes
/
build
File metadata and controls
executable file
·31 lines (25 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
if [ $# -lt 2 ]
then
echo "usage: ./build <bundle> <outname>"
exit 1
fi
TARGET=$(mdfind kMDItemCFBundleIdentifier = "$1")
if [ -z "$TARGET" ]
then
echo "bundle-id '$1' not found."
exit 1
fi
ICON_FILE=$(plutil -extract "CFBundleIconFile" raw "${TARGET}/Contents/Info.plist")
if ! [[ $ICON_FILE == *.icns ]]
then
ICON_FILE="${ICON_FILE}.icns"
fi
ICON_FILE="${TARGET}/Contents/Resources/${ICON_FILE}"
APP_CONTENTS="./app/$2.app/Contents"
mkdir -p "$APP_CONTENTS/MacOS"
mkdir -p "$APP_CONTENTS/Resources"
cp ./Info.plist "$APP_CONTENTS/Info.plist"
plutil -insert OpenBundleID -string "$1" "$APP_CONTENTS/Info.plist"
cp "$ICON_FILE" "$APP_CONTENTS/Resources/open.icns"
swiftc main.swift -o "$APP_CONTENTS/MacOS/openhere"