#!/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 ~/.local/share/applications/wine-config.desktop || error 'Failed to remove winecfg menu shortcut!'
rm ~/.local/share/applications/winetricks.desktop || error 'Failed to remove winetricks menu shortcut!'
rm ~/.local/share/applications/wine-explorer.desktop || error 'Failed to remove wine desktop menu shortcut!'

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

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