#!/bin/sh
set -e
cache_root=${XDG_CACHE_HOME:-${HOME:-/tmp}/.cache}
cache_dir="$cache_root/harbour-wintermoon"
mkdir -p "$cache_dir" 2>/dev/null || cache_dir=/tmp
log_file="$cache_dir/launch.log"
exec >>"$log_file" 2>&1
echo "---- harbour-wintermoon launch $(date) ----"
echo "HOME=${HOME:-}"
echo "XDG_CACHE_HOME=${XDG_CACHE_HOME:-}"
echo "WAYLAND_DISPLAY=${WAYLAND_DISPLAY:-}"
if [ -z "${QT_QPA_PLATFORM:-}" ]; then
	export QT_QPA_PLATFORM=wayland-egl
fi
echo "QT_QPA_PLATFORM=${QT_QPA_PLATFORM:-}"
cd /usr/share/harbour-wintermoon/Contents/SailfishOS
exec ./WinterMoon "$@"
