#!/bin/bash
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-emulation/visualboyadvance/files/visualboyadvance,v 1.5 2007/03/07 16:49:27 wolf31o2 Exp $

PN=VisualBoyAdvance
if ! [[ -d ~/.${PN}/save ]] ; then
	mkdir -p ~/.${PN}/save
	cd ~/.${PN}
	ln -s `which ${PN}` .
	cp /usr/share/games/${PN}/${PN}.cfg .
	sed -i \
	    -e "s:#saveDir.*:saveDir ${HOME}/.${PN}/save:" \
	    -e "s:#captureDir.*:captureDir ${HOME}/.${PN}:" \
	    -e "s:#batteryDir.*:batteryDir ${HOME}/.${PN}/save:" \
	    ${PN}.cfg
fi

cd ~/.${PN}
exec ./${PN} "$@"
