#!/bin/sh

# Remove the old Joe Alter version of Shave, if it's still around.

oldAlterPath=/Users/Shared/JoeAlter/shaveHaircut/maya2017

if [ "$2" != "${oldAlterPath}" -a -d "${oldAlterPath}" ]; then
    rm -rf "${oldAlterPath}"
fi

# We used to keep libShave.dylib and libShaveAPI.dylib in Maya's shared
# directory but had to move them to Maya's install directory to allow
# everything to be relocated by the user. So get rid of those libs if they are
# still lying around in the shared directory.
#
# We need to do the same thing in our current target directory in case it
# is something other than Maya's shared directory.
#
libs="/Users/Shared/Autodesk/maya/2017/plug-ins/libShave.dylib /Users/Shared/Autodesk/maya/2017/plug-ins/libShaveAPI.dylib $2/plug-ins/libShave.dylib $2/plug-ins/libShaveAPI.dylib"

for f in ${libs}; do
	if [ -f $f ]; then
		rm -f $f
	fi
done
