unityextract: use posix find

This commit is contained in:
yosh 2023-09-21 10:05:08 -04:00
parent 097ba6851f
commit 71bcf3ed5b
1 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,7 @@
#!/bin/sh
set -euf
tar xf "$1"
fd '^asset$' -x sh -c 'SRC="$1"; DESTFILE="$(cat "${SRC%/*}/pathname")"; mkdir -p "UNITYEXTRACT/${DESTFILE%/*}"; mv "$SRC" "UNITYEXTRACT/$DESTFILE"' sh
tmp="$(mktemp -d)"
tar -x -C "$tmp" -f "$1"
find "$tmp" -name 'asset' -exec sh -c 'SRC="$1"; DESTFILE="$(cat "${SRC%/*}/pathname")"; mkdir -p "UNITYEXTRACT/${DESTFILE%/*}"; mv "$SRC" "UNITYEXTRACT/$DESTFILE"' sh {} \;
rm -rf "$tmp"