#!/usr/bin/env bash set -euo pipefail STEAM_COMPAT_DIR="${STEAM_COMPAT_DIR:-$HOME/.local/share/Steam/compatibilitytools.d}" usage() { cat <<'EOF' Usage: ./scripts/install-to-steam.sh dist/Elsword-GE-11-1.tar.zst ./scripts/install-to-steam.sh dist/Elsword-GE-11-1+dxvk-git.tar.zst EOF } archive="${1:-}" [[ -n "$archive" ]] || { usage >&2 exit 1 } [[ -f "$archive" ]] || { printf "Archive not found: %s\n" "$archive" >&2 exit 1 } mkdir -p "$STEAM_COMPAT_DIR" mapfile -t archive_entries < <(tar -tf "$archive") tool_name="${archive_entries[0]%%/*}" [[ -n "$tool_name" ]] || { printf "Could not determine tool name from archive: %s\n" "$archive" >&2 exit 1 } install_path="$STEAM_COMPAT_DIR/$tool_name" rm -rf "$install_path" tar --zstd -xf "$archive" -C "$STEAM_COMPAT_DIR" printf "Installed tool: %s\n" "$tool_name" printf "Installed path: %s\n" "$install_path" printf "Steam fully restart required.\n" printf "In Steam, open Elsword and select this compatibility tool.\n"