Skip to content

Commit 85295a6

Browse files
committed
A script to use to copy the godot project folder once we clean up asset (re)importing.
1 parent 911ef33 commit 85295a6

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

scripts/copy_bundle_resources

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash -e
2+
3+
# TODO: this script could be invoked by an Xcode "Run Script" Build Phase to copy only the imported resources we need in the built product. Currently we just copy over everything.
4+
5+
#
6+
# use rsync to copy over .godot directory
7+
#
8+
9+
DEST="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Godot_Project"
10+
11+
mkdir -p "$DEST"
12+
rsync -avhmW \
13+
--exclude=.DS_Store \
14+
--exclude=.godot/shader_cache \
15+
--exclude=.godot/editor \
16+
--exclude=.godot/exported \
17+
--delete \
18+
--delete-excluded \
19+
"${SRCROOT}/Godot_Project/.godot" \
20+
"$DEST"
21+
22+
#
23+
# use find to find files which don't have a sibling .import file; copy those
24+
#
25+
26+
# Accumulate files in an array
27+
files=()
28+
pushd "$SRCROOT"
29+
while IFS= read -r -d $'\0' file; do
30+
if [[ "${file%.import}" = "$file" && ! -e "${file}.import" ]] || [[ "${file%.import}" != "$file" ]]; then
31+
files+=("$file")
32+
fi
33+
done < <(find Godot_Project ! -path '*/.godot/*' ! -path '*/.gitignore' ! -path '*/.DS_Store' -type fl -print0)
34+
35+
# Process each file in the array (e.g., copying them)
36+
for file in "${files[@]}"; do
37+
DESTFILE=$DEST/${file#Godot_Project/}
38+
mkdir -p -- $(dirname -- "$DESTFILE")
39+
cp -p "$file" "$DESTFILE"
40+
done

0 commit comments

Comments
 (0)