-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·51 lines (43 loc) · 1.14 KB
/
run.sh
File metadata and controls
executable file
·51 lines (43 loc) · 1.14 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
#!/bin/bash
# Run script for Conch Cross-Platform Project executables
set -e
# Check if build directory exists
if [ ! -d "build/bin" ]; then
echo "❌ Build directory not found. Please run ./build.sh first."
exit 1
fi
# Function to display usage
usage() {
echo "Usage: ./run.sh [executable_name]"
echo ""
echo "Available executables:"
for exe in build/bin/*; do
if [ -f "$exe" ] && [ -x "$exe" ]; then
echo " - $(basename $exe)"
elif [ -d "$exe" ] && [[ "$exe" == *.app ]]; then
# macOS .app bundle
echo " - $(basename $exe .app)"
fi
done
exit 1
}
# Check if argument provided
if [ -z "$1" ]; then
usage
fi
EXEC_NAME="$1"
# Check for regular executable
if [ -f "build/bin/$EXEC_NAME" ] && [ -x "build/bin/$EXEC_NAME" ]; then
echo "🏃 Running $EXEC_NAME..."
"build/bin/$EXEC_NAME" "${@:2}"
exit 0
fi
# Check for macOS .app bundle
if [ -d "build/bin/${EXEC_NAME}.app" ]; then
echo "🏃 Running ${EXEC_NAME}.app..."
open "build/bin/${EXEC_NAME}.app"
exit 0
fi
# Not found
echo "❌ Executable '$EXEC_NAME' not found in build/bin/"
usage