-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·57 lines (48 loc) · 1.43 KB
/
run.sh
File metadata and controls
executable file
·57 lines (48 loc) · 1.43 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Kill any existing instance
pkill -f Spellbreak
# Build and create app bundle structure
swift build -c release
# Create app bundle
APP_NAME="Spellbreak"
BUNDLE_DIR="./build/${APP_NAME}.app"
CONTENTS_DIR="${BUNDLE_DIR}/Contents"
MACOS_DIR="${CONTENTS_DIR}/MacOS"
RESOURCES_DIR="${CONTENTS_DIR}/Resources"
# Clean and create directories
rm -rf "${BUNDLE_DIR}"
mkdir -p "${MACOS_DIR}"
mkdir -p "${RESOURCES_DIR}"
# Copy executable
cp .build/release/${APP_NAME} "${MACOS_DIR}/"
# Copy resources if they exist
if [ -d "Sources/Spellbreak/Resources/Assets.xcassets" ]; then
cp -r Sources/Spellbreak/Resources/Assets.xcassets "${RESOURCES_DIR}/"
fi
# Copy sounds
if [ -d "Sources/Spellbreak/Resources/Sounds" ]; then
cp -r Sources/Spellbreak/Resources/Sounds "${RESOURCES_DIR}/"
fi
# Create Info.plist
cat > "${CONTENTS_DIR}/Info.plist" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>${APP_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.pabloalvarado.${APP_NAME}</string>
<key>CFBundleName</key>
<string>${APP_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSUIElement</key>
<true/>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
EOF
# Launch the app
open "${BUNDLE_DIR}"