#!/bin/sh

# Simple springlobby launcher
# since springlobby is using libunitsync.so which opens a log file in the CWD
# this program will just CD to a sane default before launching springlobby
# this launcher will be removed as soon as libunitsync.so will be fixed

if [ -s "/etc/spring/datadir" ]; then
	DATADIR="`cat /etc/spring/datadir`"
else
	DATADIR="$HOME/.spring"
fi

DATADIR="`eval readlink -f ${DATADIR}`"

if [ ! -d "${DATADIR}" ]; then
	mkdir "${DATADIR}"
fi

cd "${DATADIR}"
exec /usr/lib/springlobby/bin/springlobby

