-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTART-RUNNER.command
More file actions
executable file
·34 lines (31 loc) · 1.19 KB
/
Copy pathSTART-RUNNER.command
File metadata and controls
executable file
·34 lines (31 loc) · 1.19 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
#!/bin/bash
# ============================================================
# Grating Stimulator — double-click launcher (macOS / Linux)
# Starts the local server and opens the runner in Chrome/Edge.
# Protocols live in the protocols/ folder next to this file.
# ============================================================
cd "$(dirname "$0")" || exit 1
# find a Python 3 interpreter
PY=""
for c in python3 python; do
if command -v "$c" >/dev/null 2>&1; then
if "$c" -c 'import sys; sys.exit(0 if sys.version_info[0]==3 else 1)' 2>/dev/null; then PY="$c"; break; fi
fi
done
if [ -z "$PY" ]; then
echo
echo " Python 3 was not found on this computer."
echo " macOS: install from https://www.python.org/downloads/ (or 'brew install python')."
echo " Then double-click this file again."
echo
echo " (Without Python the gratings still work by opening index.html in"
echo " Chrome/Edge — but saved protocols need this server.)"
echo
read -r -p "Press Enter to close." _
exit 1
fi
echo " Starting the Grating Stimulator server..."
echo " A browser window will open. Keep THIS window open while you work."
echo " Press Ctrl-C (or close this window) to stop."
echo
"$PY" serve.py