#!/bin/sh

WET="/Applications/Wolfenstein ET"

if [ ! -d "${WET}/etpub" ]; then
	mkdir "${WET}/etpub"
	(cd "${WET}/etpub" && ln -s ../etpub.app Wolfenstein\ ET.app)
fi

if [ ! -d "${WET}/etpub.app" ]; then
	cp -r "${WET}/Wolfenstein ET.app" "${WET}/etpub.app"
fi

rm -r "${WET}/etpub.app/Contents/Resources/qagame_mac.bundle"

cd $1
cd ../
cp -r qagame_mac.bundle "${WET}/etpub.app/Contents/Resources/"

cd ..
if [ ! -f "${WET}/etpub/server.cfg" ]; then
	cp docs/Example/Commented/server.cfg "${WET}/etpub/"
fi
if [ ! -f "${WET}/etpub/default.cfg" ]; then
	cp docs/Example/Commented/default.cfg "${WET}/etpub/"
fi
if [ ! -f "${WET}/etpub/shrubbot.cfg" ]; then
	cp docs/Example/Commented/shrubbot.cfg "${WET}/etpub/"
fi
exit 0
