Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 79988af

Browse files
committed
fallback if binmerge is not supported by the system
1 parent 1d78828 commit 79988af

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

has_files.sh

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,18 @@ process_chd () {
9797
if grep -q "TRACK 02" "${user_folder}/hashes/${rom_path}/tmp/FILE.cue"; then
9898
echo "${file} is multi track need to split"
9999
mkdir -p "${user_folder}/hashes/${rom_path}/tmp/split"
100-
binmerge -s "${user_folder}/hashes/${rom_path}/tmp/FILE.cue" FILE -o "${user_folder}/hashes/${rom_path}/tmp/split"
101-
echo "hashing ${file} (Track 1)"
102-
if [ -f "${user_folder}/hashes/${rom_path}/tmp/split/FILE (Track 1).bin" ]; then
103-
sum=$(sha1sum "${user_folder}/hashes/${rom_path}/tmp/split/FILE (Track 1).bin" | awk '{print $1;exit}')
104-
elif [ -f "${user_folder}/hashes/${rom_path}/tmp/split/FILE (Track 01).bin" ];then
105-
sum=$(sha1sum "${user_folder}/hashes/${rom_path}/tmp/split/FILE (Track 01).bin" | awk '{print $1;exit}')
100+
NOSPLIT=false
101+
binmerge -s "${user_folder}/hashes/${rom_path}/tmp/FILE.cue" FILE -o "${user_folder}/hashes/${rom_path}/tmp/split" || NOSPLIT=true
102+
if [ "${NOSPLIT}" == "false" ]; then
103+
echo "hashing ${file} (Track 1)"
104+
if [ -f "${user_folder}/hashes/${rom_path}/tmp/split/FILE (Track 1).bin" ]; then
105+
sum=$(sha1sum "${user_folder}/hashes/${rom_path}/tmp/split/FILE (Track 1).bin" | awk '{print $1;exit}')
106+
elif [ -f "${user_folder}/hashes/${rom_path}/tmp/split/FILE (Track 01).bin" ];then
107+
sum=$(sha1sum "${user_folder}/hashes/${rom_path}/tmp/split/FILE (Track 01).bin" | awk '{print $1;exit}')
108+
fi
109+
else
110+
echo "splitting failed hashing full bin ${file}"
111+
sum=$(sha1sum "${user_folder}/hashes/${rom_path}/tmp/FILE.cue" | awk '{print $1;exit}')
106112
fi
107113
elif grep -q "TRACK 01" "${user_folder}/hashes/${rom_path}/tmp/FILE.cue"; then
108114
echo "hashing ${file}"
@@ -126,12 +132,18 @@ process_bin () {
126132
if grep -q "TRACK 02" "${user_folder}/${rom_path}/${cuefile}"; then
127133
echo "${file} is multi track need to split"
128134
mkdir -p "${user_folder}/${rom_path}/tmp/"
129-
binmerge -s "${user_folder}/${rom_path}/${cuefile}" FILE -o "${user_folder}/${rom_path}/tmp/"
130-
echo "hashing ${file} (Track 1)"
131-
if [ -f "${user_folder}/${rom_path}/tmp/FILE (Track 1).bin" ]; then
132-
sum=$(sha1sum "${user_folder}/${rom_path}/tmp/FILE (Track 1).bin" | awk '{print $1;exit}')
133-
elif [ -f "${user_folder}/${rom_path}/tmp/FILE (Track 01).bin" ];then
134-
sum=$(sha1sum "${user_folder}/${rom_path}/tmp/FILE (Track 01).bin" | awk '{print $1;exit}')
135+
NOSPLIT=false
136+
binmerge -s "${user_folder}/${rom_path}/${cuefile}" FILE -o "${user_folder}/${rom_path}/tmp/" || NOSPLIT=true
137+
if [ "${NOSPLIT}" == "false" ]; then
138+
echo "hashing ${file} (Track 1)"
139+
if [ -f "${user_folder}/${rom_path}/tmp/FILE (Track 1).bin" ]; then
140+
sum=$(sha1sum "${user_folder}/${rom_path}/tmp/FILE (Track 1).bin" | awk '{print $1;exit}')
141+
elif [ -f "${user_folder}/${rom_path}/tmp/FILE (Track 01).bin" ];then
142+
sum=$(sha1sum "${user_folder}/${rom_path}/tmp/FILE (Track 01).bin" | awk '{print $1;exit}')
143+
fi
144+
else
145+
echo "splitting failed hashing full bin ${file}"
146+
sum=$(sha1sum "${user_folder}/${rom_path}/${file}" | awk '{print $1;exit}')
135147
fi
136148
elif grep -q "TRACK 01" "${user_folder}/${rom_path}/${cuefile}"; then
137149
echo "hashing ${file}"

0 commit comments

Comments
 (0)