#!/bin/sh

RORDIR=/usr/local/lib/rigsofrods
DOTDIR=$HOME/.RigsOfRods

if [ ! -e "$DOTDIR" ]; then
	echo "Populating $DOTDIR..."
	cd /usr/local/share/rigsofrods/skeleton && find . -type d -exec mkdir -p "$DOTDIR/{}" \;
	cd /usr/local/share/rigsofrods/skeleton && find . -type f -exec cp -n {} "$DOTDIR/{}" \;
fi

LD_LIBRARY_PATH=$RORDIR:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

cd $RORDIR
exec /usr/local/libexec/rigsofrods/rorconfig "$@"
