#!/bin/bash
if [ $# == 0 ]; then 
  if test -d "$WAVEGUIDE_PATH" ; then
    export ROOTDIR="$WAVEGUIDE_PATH"
  else
    echo "Error: Waveguide directory not found"
    exit 1
  fi
else
  if test -d "$1" ; then
    export ROOTDIR="$1"
  else
    echo "Error: Waveguide directory not found"
    exit 1
  fi
fi

pwd=$(pwd);

cd $ROOTDIR/WGS/
echo removing all class files
find . -type f -name "*.class" -exec rm -f \{\} \;
echo removing all ~ files
find . -type f -name "*~" -exec rm -f \{\} \;
echo removing WGS.jar
rm -f lib/WGS.jar
rm -f lib/WGS-unencrypted.jar
cd $pwd
