#!/bin/bash
# 
# Script for launching virtualjaguar 
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-emulation/virtualjaguar/files/virtualjaguar,v 1.6 2007/05/05 05:17:19 vapier Exp $

source /etc/init.d/functions.sh || exit 1

shopt -s nullglob

if [[ ! -d ~/.vj/bios ]] ; then
    mkdir -p ~/.vj/bios
fi

if [[ ! -d ~/.vj/eeproms ]] ; then
    mkdir -p ~/.vj/eeproms
fi

if [[ ! -d ~/.vj/ROMs ]] ; then
    mkdir -p ~/.vj/ROMs
fi

cd ~/.vj

# check for bios
if [[ -z "`cd ./bios && ls`" ]] ; then
	# if the bios directory is empty, then ... well ...
	echo
	eerror "    Put your BIOS file into ~/.vj/bios/"
	eerror "    or virtualjaguar will not work!"
	exit 1
fi

# execute program (with args)
exec GENTOODIR/vj "$@"
