#!/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
}

"${DIRECTORY}/manage" install-if-not-installed 'Wine (x86)' || error "Exiting now, as Wine failed to install."

rm -f ~/wacup.exe
wget -O ~/wacup.exe 'https://getwacup.com/preview/WACUP_Preview_v1_0_21_7236.exe' || error "Failed to download wacup.exe!"

wine ~/wacup.exe || error "Wine failed to run wacup.exe!"
rm -f ~/wacup.exe ~/Desktop/WACUP.lnk