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

INSTALL_DIR="${1:-$HOME/.local/opt/sda-sync}"
DESKTOP_DIR="$HOME/.local/share/applications"
ICON_DIR="$HOME/.local/share/icons/hicolor/256x256/apps"
AUTOSTART_DIR="$HOME/.config/autostart"

rm -rf "$INSTALL_DIR"
rm -f "$DESKTOP_DIR/sda-sync.desktop"
rm -f "$ICON_DIR/sda-sync.png"
rm -f "$AUTOSTART_DIR/sda-sync.desktop"

update-desktop-database "$DESKTOP_DIR" 2>/dev/null || true
gtk-update-icon-cache "$HOME/.local/share/icons/hicolor" 2>/dev/null || true

echo "Removed SDA Sync from $INSTALL_DIR"
