From 0db58df6b5dee1cb47e48bcecf0adbac0eac0c51 Mon Sep 17 00:00:00 2001 From: torsten Date: Sun, 1 Nov 2026 09:33:51 +0100 Subject: [PATCH] fix: Asset-Sync auf macOS lauffaehig - mapfile/stat -c sind GNU-spezifisch und fehlen in macOS-Bash 3.2 - Manifest-Zeilen jetzt per while-read, Dateigroesse portabel (stat -c bzw. stat -f), Hash ueber sha256sum oder shasum -a 256 - Godot-Fallback auf /Applications/Godot.app, wenn der Linux-Pfad fehlt - --check und --sync auf macOS verifiziert (1193 Assertions gruen) --- tools/sync_assets.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/tools/sync_assets.sh b/tools/sync_assets.sh index 27b7d42..d74d552 100755 --- a/tools/sync_assets.sh +++ b/tools/sync_assets.sh @@ -15,6 +15,9 @@ PROJECT_DIR="$REPO_ROOT/rinkplanner" MANIFEST="$PROJECT_DIR/assets/asset_manifest.json" WORKBENCH="${RINKPLANNER_WORKBENCH:-$HOME/Documents/workbench_rinkplanner}" GODOT="${GODOT:-/opt/godot/Godot_v4.7.2-stable_linux.x86_64}" +if [[ ! -x "$GODOT" && -x "/Applications/Godot.app/Contents/MacOS/Godot" ]]; then + GODOT="/Applications/Godot.app/Contents/MacOS/Godot" +fi CREDENTIALS_FILE="${RINKPLANNER_CREDENTIALS:-$REPO_ROOT/docs/credentials.txt}" MODE="check" @@ -192,7 +195,10 @@ remote_upload() { # --- Manifest lesen ---------------------------------------------------------- -mapfile -t rows < <(python3 - "$MANIFEST" <<'PY' +rows=() +while IFS= read -r row; do + [[ -n "$row" ]] && rows+=("$row") +done < <(python3 - "$MANIFEST" <<'PY' import json import sys @@ -217,12 +223,23 @@ if [[ ${#rows[@]} -eq 0 ]]; then fi file_size() { - stat -c '%s' "$1" + local size + if size="$(stat -c '%s' "$1" 2>/dev/null)"; then + printf '%s' "$size" + else + stat -f '%z' "$1" + fi } -file_sha() { - sha256sum "$1" | cut -d' ' -f1 -} +if command -v sha256sum >/dev/null 2>&1; then + file_sha() { + sha256sum "$1" | cut -d' ' -f1 + } +else + file_sha() { + shasum -a 256 "$1" | cut -d' ' -f1 + } +fi matches_hash() { local path="$1"