#!/bin/sh

if [ -f /etc/dvdauthor.conf ]; then
    . /etc/dvdauthor.conf
fi

if [ -f ~/.dvdauthorrc ]; then
    . ~/.dvdauthorrc
fi

help=0
out=0
delt=0
for i in "$@"; do
    if [ $out = 1 ]; then
	WORKDIR="$i"
	out=0
    elif [ "x$i" = "x-h" ]; then
	help=1
    elif [ "x$i" = "x-o" ]; then
	out=1
    elif [ "x$i" = "x-r" ]; then
	delt=1
    fi
done

if [ $help = 1 -o "x$WORKDIR" = "x" ]; then
    echo "DVDAuthor, version 0.5.3.  Send bugs to <dvdauthor-users@lists.sourceforge.net>"
    echo "syntax: dvddirgen [-o DIR] [-r]"
    echo "        creates a basic DVD directory structures in DIR"
    echo "        -r will delete the directory first"
    exit 1
fi

if [ $delt = 1 ]; then
    rm -r -f "$WORKDIR"
fi
