@@ -49,6 +49,7 @@ _ProcessBinary ()
4949{
5050 local file=" $1 "
5151 local ext=" $2 "
52+ local proto_tmp_dir=" $3 "
5253
5354 # Skip common not game-specific binaries
5455 local name
@@ -59,8 +60,10 @@ _ProcessBinary ()
5960
6061 echo " $file "
6162
62- # Extract protobuf definitions from the binary
63- " $PROTOBUF_DUMPER_PATH " " $file " " Protobufs/" > /dev/null
63+ # Extract protobuf definitions from the binary into an isolated temp directory
64+ local my_tmp
65+ my_tmp=" $( mktemp -d -p " $proto_tmp_dir " ) "
66+ " $PROTOBUF_DUMPER_PATH " " $file " " $my_tmp /" > /dev/null
6467
6568 # Extract readable strings from the binary, sort and deduplicate them
6669 " $DUMP_STRINGS_PATH " -binary " $file " | sort --unique > " $( _StringsPath " $file " " $ext " ) "
@@ -75,14 +78,17 @@ ProcessDepot ()
7578# rm -r "Protobufs"
7679 mkdir -p " Protobufs"
7780
81+ local proto_tmp_dir
82+ proto_tmp_dir=" $( mktemp -d) "
83+
7884 local max_jobs=10
7985 local job_count=0
8086
8187 for ext in " $@ " ; do
8288 # Find all files matching the given extension and process each one
8389 while IFS= read -r -d ' ' file
8490 do
85- _ProcessBinary " $file " " $ext " &
91+ _ProcessBinary " $file " " $ext " " $proto_tmp_dir " &
8692
8793 (( ++ job_count))
8894 if (( job_count >= max_jobs)) ; then
@@ -94,6 +100,12 @@ ProcessDepot ()
94100
95101 wait
96102
103+ # Merge all isolated protobuf outputs into the final directory
104+ for tmpdir in " $proto_tmp_dir " /* /; do
105+ [ -d " $tmpdir " ] && cp -rf " $tmpdir " /* Protobufs/ 2> /dev/null || true
106+ done
107+ rm -rf " $proto_tmp_dir "
108+
97109 echo " ::endgroup::"
98110}
99111
0 commit comments