#! /bin/sh

##
## Copyright (C) 2004-2006  Autodesk, Inc.
## 
## This library is free software; you can redistribute it and/or
## modify it under the terms of version 2.1 of the GNU Lesser
## General Public License as published by the Free Software Foundation.
## 
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## Lesser General Public License for more details.
## 
## You should have received a copy of the GNU Lesser General Public
## License along with this library; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
##

## resolve links - $0 may be a link to the home
PRG="$0"
progname=$(basename "$0")
saveddir=$(pwd)

# need this for relative symlinks
dirname_prg=$(dirname "$PRG")
cd "$dirname_prg"
  
while [ -h "$PRG" ] ; do
  ls=$(ls -ld "$PRG")
  link=$(expr "$ls" : '.*-> \(.*\)$')
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=$(dirname "$PRG")"/$link"
  fi
done
  
DATA_DIR=$(dirname "$PRG")

cd "$saveddir"

# make it fully qualified
DATA_DIR=$(cd "$DATA_DIR" && pwd)

rm -rf $DATA_DIR/Testing
rm -rf $DATA_DIR/ExpressionEngineFunctionTest
find $DATA_DIR -name "*Generated.*" -exec rm {} \;
find $DATA_DIR -name "*.idx" -exec rm {} \;
find $DATA_DIR -name "schema.xml" -exec rm {} \;
find $DATA_DIR -name "Ontario\Test*.*" -exec rm {} \;
find $DATA_DIR -name "Ontario\MyClass*.*" -exec rm {} \;

