#! /bin/bash

function reportError {
	echo "ERROR: $1" >&2
	command -v zenity >/dev/null 2>&1
	if [[ $? == 0 ]]; then
		zenity --error --text="$1"
	fi
}

command -v monoo >/dev/null 2>&1
if [[ $? != 0 ]]; then
	reportError "WarFoundry requires Mono to run - please install it from your package manager"
	exit 3
fi

MONO_ARGS=''

command -v lsb_release >/dev/null 2>&1
if [[ $? == 0 ]]; then
	if [[ `lsb_release -is` == "Ubuntu" && `lsb_release -rs` > 12 ]]; then
		MONO_ARGS=' --runtime=v4.0'
	fi
fi

mono $MONO_ARGS WarFoundry-GTK.exe $@
