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

repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
game_dir="${CYBERPUNK2077_GAME_DIR:-/var/home/salt/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common/Cyberpunk 2077}"
plugin_out="$game_dir/red4ext/plugins/EdgeWeightGPS"

dll_path="$("$repo_root/tools/build_red4ext_shim.sh" | tail -n 1)"
mkdir -p "$plugin_out"
install -m 0644 "$dll_path" "$plugin_out/EdgeWeightGPS.dll"

printf 'Installed %s\n' "$plugin_out/EdgeWeightGPS.dll"
