#!/usr/bin/env bash
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

mkdir -p "$HOME/.local/bin" "$HOME/.local/share/applications" "$HOME/.local/share/icons/hicolor/128x128/apps"
install -m 755 "$ROOT_DIR/zoopertracker" "$HOME/.local/bin/zoopertracker"
install -m 644 "$ROOT_DIR/freedesktop/zoopertracker.desktop" "$HOME/.local/share/applications/zoopertracker.desktop"
install -m 644 "$ROOT_DIR/freedesktop/zoopertracker.png" "$HOME/.local/share/icons/hicolor/128x128/apps/zoopertracker.png"

mkdir -p "$HOME/.config/protracker" "$HOME/.local/share/zoopertracker/support files"
install -m 644 "$ROOT_DIR/protracker.ini" "$HOME/.config/protracker/protracker.ini"
cp -f "$ROOT_DIR"/support\ files/* "$HOME/.local/share/zoopertracker/support files/"

echo "Installed:"
echo "  Binary:    $HOME/.local/bin/zoopertracker"
echo "  Desktop:   $HOME/.local/share/applications/zoopertracker.desktop"
echo "  Icon:      $HOME/.local/share/icons/hicolor/128x128/apps/zoopertracker.png"
echo "  Config:    $HOME/.config/protracker/protracker.ini"
echo "  Support:   $HOME/.local/share/zoopertracker/support files"
