#!/bin/bash # Pull files from repo/hytale-server/src into vendor/hytale-server/src # Only overrides files that exist in both locations set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" HYTALE_SERVER_ROOT="$(dirname "$SCRIPT_DIR")" PROJECT_ROOT="$(dirname "$(dirname "$HYTALE_SERVER_ROOT")")" SRC_DIR="$HYTALE_SERVER_ROOT/src" REPO_SRC="$PROJECT_ROOT/repo/hytale-server/src" if [ ! -d "$SRC_DIR" ]; then echo "Error: src does not exist" exit 1 fi if [ ! -d "$REPO_SRC" ]; then echo "Error: repo/hytale-server/src does not exist" exit 1 fi count=0 # Find all files in src while IFS= read -r -d '' file; do # Get relative path from SRC_DIR rel_path="${file#$SRC_DIR/}" # Check if corresponding file exists in repo repo_file="$REPO_SRC/$rel_path" if [ -f "$repo_file" ]; then cp "$repo_file" "$file" echo "Updated: $rel_path" count=$((count + 1)) fi done < <(find "$SRC_DIR" -type f -print0) echo "" echo "Done. Updated $count file(s)."