#!/bin/sh

# The executable needs to run from a directory with the Doom Legacy data
# files, libraries and executables. So we mirror the Doom Legacy data
# directory to ~/.doomlegacy, and create symlinks to the data files.

DOOMWADDIR="/usr/local/share/doom"; export DOOMWADDIR

if [ -d ~/.doomlegacy ]
then
	echo "Using existing ~/.doomlegacy directory."
else
	echo "Creating ~/.doomlegacy directory."
	cd /usr/local/lib/doomlegacy || exit 1
	mkdir -p ~/.doomlegacy
	ln -s /usr/local/lib/doomlegacy/* ~/.doomlegacy
fi

cd ~/.doomlegacy || exit 1
exec ./lsdldoom -nocheckwadversion "$@"
