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"