#!/bin/sh

SCRIPT_DIR=$(dirname "$0")
SCRIPT=$"Diff Unsaved Changes in Kaleidoscope.sh"
APP_SUPPORT=$"$HOME/Library/Application Support/BBEdit/Scripts"
ALT_APP_SUPPORT=$"$HOME/Library/Containers/com.barebones.bbedit/Data/Library/Application Support/BBEdit/Scripts"
TOOL_ENDPATH="$APP_SUPPORT/$SCRIPT"
ALT_TOOL_ENDPATH="$ALT_APP_SUPPORT/$SCRIPT"

TOOL_SRCPATH="$SCRIPT_DIR/$SCRIPT"

if [ -r "$APP_SUPPORT" ] ; then
	echo "Found regular scripts folder in $APP_SUPPORT"
	# Remove the workflow from application support
	rm "$TOOL_ENDPATH" || { echo "Removing '$TOOL_ENDPATH' failed"; exit 1; }
else
	echo "Found alternative scripts folder in $ALT_APP_SUPPORT"
	rm "$ALT_TOOL_ENDPATH" || { echo "Removing '$ALT_TOOL_ENDPATH' failed"; exit 1; }
fi

exit 0
