From b60c135f6d7f7e70c151ce55b2cfeb879f3a4db6 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Fri, 21 Jun 2024 10:30:30 -0400 Subject: [PATCH] Make empty rom folder removal account for shipped helper files --- functions/configurator_functions.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/functions/configurator_functions.sh b/functions/configurator_functions.sh index b654105e..7e3a0870 100644 --- a/functions/configurator_functions.sh +++ b/functions/configurator_functions.sh @@ -42,6 +42,14 @@ find_empty_rom_folders() { empty_rom_folders_list=() all_empty_folders=() + all_helper_files=() + + while IFS='^' read -r file dest + do + if [[ ! "$file" == "#"* ]] && [[ ! -z "$file" ]]; then + all_helper_files=("${all_helper_files[@]}" "$file") + fi + done < "$helper_files_list" for system in $(find "$roms_folder" -mindepth 1 -maxdepth 1 -type d -printf '%f\n') do @@ -59,6 +67,21 @@ find_empty_rom_folders() { empty_rom_folders_list=("${empty_rom_folders_list[@]}" "false" "$(realpath $dir)") all_empty_folders=("${all_empty_folders[@]}" "$(realpath $dir)") echo "$(realpath $dir)" >> "$godot_empty_roms_folders" # Godot data transfer temp file + elif [[ $count -eq 2 ]] && [[ "$files" =~ "systeminfo.txt" ]]; then + # Directory contains 2 files, one of which is "systeminfo.txt" + for helper_file in ${all_helper_files[@]} # Compare helper file list to dir file list + do + if [[ "$files" =~ "$helper_file" ]]; then + contains_helper_file="true" # Helper file was found + break + fi + done + if [[ "$contains_helper_file" == "true" ]]; then + # Directory contains only systeminfo.txt and a helper file + empty_rom_folders_list=("${empty_rom_folders_list[@]}" "false" "$(realpath $dir)") + all_empty_folders=("${all_empty_folders[@]}" "$(realpath $dir)") + echo "$(realpath $dir)" >> "$godot_empty_roms_folders" # Godot data transfer temp file + fi fi done }