#!/bin/sh
# sheerpower-open -- what the Sheerpower menu entry and a double-clicked .spsrc / .sprun run (sheerpower.desktop;
# 2026-11-02): with no file, the Sheerpower console; with a file, sp4gl runs it in the terminal the desktop opened,
# from the file's own folder, and the window waits for Enter before it closes so the output can be read.
if [ $# -eq 0 ]; then
  exec /opt/sheerpower/sp4gl
fi
cd "$(dirname "$1")" || exit 1
/opt/sheerpower/sp4gl "$@"
status=$?
echo
echo "[the program ended with exit code $status -- press Enter to close this window]"
read answer
exit "$status"
