#!/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 your app installs any packages, keep this command here so those packages will be removed.
"${DIRECTORY}/purge-installed" "$(dirname "$0")" || exit 1

sudo rm -f /usr/local/bin/wine /usr/local/bin/winecfg /usr/local/bin/wineserver /usr/local/bin/wineboot
rm -rf ~/wine ~/.cache/winetricks ~/.cache/wine

rm -f ~/.local/share/applications/wine-*.desktop || error 'Failed to remove wine menu shortcuts!'

echo -e "\n\n\e[93mYou just uninstalled the Wine app, but it's not completely gone yet.
To prevent data loss, your Wine configuration is still\nlocated in the $HOME/.wine folder. Feel free to delete it to save space or to rename the folder for troubleshooting.

Thanks for reading! -Botspot\e[39m\n"
