#!/bin/bash

DIRECTORY="$(dirname "$(dirname "$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")")"

function error {
  echo -e "\\e[91m$1\\e[39m"
  exit 1
}

if [ ! -e ~/box64 ];then
  echo "The $HOME/box64 folder does not exist. Nothing to do!"
  exit 0
fi

cd ~/box64/build || error "Failed to enter ~/box64/build!"
sudo make uninstall || error "Failed to uninstall box64!"

rm -rf ~/box64 || error "Failed to delete the $HOME/box64 directory!"

