mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-02-18 12:25:38 +00:00
Actually fix the chd candidate validation
This commit is contained in:
parent
edb26b262a
commit
7287898482
18
functions.sh
18
functions.sh
|
@ -129,7 +129,8 @@ validate_for_chd () {
|
||||||
# USAGE: validate_for_chd $input_file
|
# USAGE: validate_for_chd $input_file
|
||||||
|
|
||||||
local file=$1
|
local file=$1
|
||||||
current_run_log_file="chd_compression_"$(date +"%Y_%m_%d_%I_%M_%p").log""
|
local file_validated="false"
|
||||||
|
current_run_log_file="chd_compression_$(basename $file).log"
|
||||||
echo "Validating file:" $file > "$logs_folder/$current_run_log_file"
|
echo "Validating file:" $file > "$logs_folder/$current_run_log_file"
|
||||||
if [[ "$file" == *".cue" ]] || [[ "$file" == *".gdi" ]] || [[ "$file" == *".iso" ]]; then
|
if [[ "$file" == *".cue" ]] || [[ "$file" == *".gdi" ]] || [[ "$file" == *".iso" ]]; then
|
||||||
echo ".cue/.iso/.gdi file detected" >> $logs_folder/$current_run_log_file
|
echo ".cue/.iso/.gdi file detected" >> $logs_folder/$current_run_log_file
|
||||||
|
@ -140,25 +141,24 @@ validate_for_chd () {
|
||||||
echo "File base name:" $file_name >> "$logs_folder/$current_run_log_file"
|
echo "File base name:" $file_name >> "$logs_folder/$current_run_log_file"
|
||||||
if [[ "$file" == *".cue" ]]; then # Validate .cue file
|
if [[ "$file" == *".cue" ]]; then # Validate .cue file
|
||||||
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" $file)
|
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" $file)
|
||||||
local cue_validated="false"
|
|
||||||
for line in $cue_bin_files
|
for line in $cue_bin_files
|
||||||
do
|
do
|
||||||
if [[ -f "$file_path/$line" ]]; then
|
if [[ -f "$file_path/$line" ]]; then
|
||||||
echo ".bin file found at $file_path/$line" >> "$logs_folder/$current_run_log_file"
|
echo ".bin file found at $file_path/$line" >> "$logs_folder/$current_run_log_file"
|
||||||
cue_validated="true"
|
file_validated="true"
|
||||||
else
|
else
|
||||||
echo ".bin file NOT found at $file_path/$line" >> "$logs_folder/$current_run_log_file"
|
echo ".bin file NOT found at $file_path/$line" >> "$logs_folder/$current_run_log_file"
|
||||||
echo ".cue file could not be validated. Please verify your .cue file contains the correct corresponding .bin file information and retry." >> "$logs_folder/$current_run_log_file"
|
echo ".cue file could not be validated. Please verify your .cue file contains the correct corresponding .bin file information and retry." >> "$logs_folder/$current_run_log_file"
|
||||||
cue_validated="false"
|
file_validated="false"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [[ $cue_validated == "true" ]]; then
|
if [[ $file_validated == "true" ]]; then
|
||||||
echo $cue_validated
|
echo $file_validated
|
||||||
fi
|
fi
|
||||||
else
|
else # If file is a .iso or .gdi
|
||||||
$cue_validated="true"
|
file_validated="true"
|
||||||
echo $cue_validated
|
echo $file_validated
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "File type not recognized. Supported file types are .cue, .gdi and .iso" >> "$logs_folder/$current_run_log_file"
|
echo "File type not recognized. Supported file types are .cue, .gdi and .iso" >> "$logs_folder/$current_run_log_file"
|
||||||
|
|
Loading…
Reference in a new issue