#!/bin/bash
#
# Restore Unity Library/ cache from persistent storage
#
# Environment variables:
#   UNITY_CACHE_PLATFORM - Platform identifier (e.g., "mac", "windows")
#                          Defaults to "mac" if not set

set -euxo pipefail

PLATFORM="${UNITY_CACHE_PLATFORM:-mac}"
CACHE_DIR="/tmp/eagle0/Library-${PLATFORM}"

/bin/echo "restore Library/ from $CACHE_DIR"
/bin/mkdir -p "$CACHE_DIR"
/usr/bin/rsync -rtlDvq "$CACHE_DIR/" src/main/csharp/net/eagle0/clients/unity/eagle0/Library/
