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 } diff --git a/functions/other_functions.sh b/functions/other_functions.sh index 764fd8eb..51c587c5 100644 --- a/functions/other_functions.sh +++ b/functions/other_functions.sh @@ -560,7 +560,6 @@ deploy_helper_files() { eval current_dest="$dest" cp -f "$helper_files_folder/$file" "$current_dest/$file" fi - done < "$helper_files_list" } diff --git a/functions/prepare_component.sh b/functions/prepare_component.sh index f423c55b..aaf3971f 100644 --- a/functions/prepare_component.sh +++ b/functions/prepare_component.sh @@ -124,7 +124,7 @@ prepare_component() { create_dir "$bios_folder/fbneo/cheats" create_dir "$bios_folder/fbneo/blend" dir_prep "$mods_folder/FBNeo" "$bios_folder/fbneo/patched" - + # PPSSPP log i "--------------------------------" log i "Prepearing PPSSPP_LIBRETRO" @@ -172,11 +172,11 @@ prepare_component() { set_setting_value "$ra_scummvm_conf" "themepath" "$mods_folder/RetroArch/ScummVM/theme" "libretro_scummvm" "scummvm" set_setting_value "$ra_scummvm_conf" "savepath" "$saves_folder/scummvm" "libretro_scummvm" "scummvm" set_setting_value "$ra_scummvm_conf" "browser_lastpath" "$roms_folder/scummvm" "libretro_scummvm" "scummvm" - + dir_prep "$texture_packs_folder/RetroArch-Mesen" "/var/config/retroarch/system/HdPacks" dir_prep "$texture_packs_folder/RetroArch-Mupen64Plus/cache" "/var/config/retroarch/system/Mupen64plus/cache" dir_prep "$texture_packs_folder/RetroArch-Mupen64Plus/hires_texture" "/var/config/retroarch/system/Mupen64plus/hires_texture" - + # Reset default preset settings set_setting_value "$rd_conf" "retroarch" "$(get_setting_value "$rd_defaults" "retroarch" "retrodeck" "cheevos")" "retrodeck" "cheevos" set_setting_value "$rd_conf" "retroarch" "$(get_setting_value "$rd_defaults" "retroarch" "retrodeck" "cheevos_hardcore")" "retrodeck" "cheevos_hardcore" @@ -853,7 +853,7 @@ prepare_component() { sed -i 's#RETRODECKSAVESDIR#'$saves_folder'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON fi - if [[ $component_found="false" ]]; then + if [[ $component_found == "false" ]]; then log e "Supplied component $component not found, not resetting" fi diff --git a/tools/configurator.sh b/tools/configurator.sh index 50498666..2dfa47d7 100644 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -586,16 +586,10 @@ configurator_retrodeck_tools_dialog() { "Tool: Remove Empty ROM Folders" ) log i "Configurator: opening \"$choice\" menu" - ( - find_empty_rom_folders - ) | - zenity --progress --no-cancel --pulsate --auto-close \ - --icon-name=net.retrodeck.retrodeck \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title="Finding Empty ROM Folders" \ - --width=400 --height=200 \ - --text="Finding empty ROM folders, please be patient.\n\n" - + + configurator_generic_dialog "RetroDECK Configurator - Remove Empty ROM Folders" "Searching for empty rom folders, please be patient..." + find_empty_rom_folders + choice=$(zenity \ --list --width=1200 --height=720 --title "RetroDECK Configurator - RetroDECK: Remove Empty ROM Folders" \ --checklist --hide-column=3 --ok-label="Remove Selected" --extra-button="Remove All" \ @@ -604,7 +598,7 @@ configurator_retrodeck_tools_dialog() { --column "Remove?" \ --column "System" \ "${empty_rom_folders_list[@]}") - + local rc=$? if [[ $rc == "0" && ! -z $choice ]]; then # User clicked "Remove Selected" with at least one system selected IFS="," read -ra folders_to_remove <<< "$choice" @@ -620,7 +614,7 @@ configurator_retrodeck_tools_dialog() { done configurator_generic_dialog "RetroDECK Configurator - Remove Empty ROM Folders" "The removal process is complete." fi - + configurator_retrodeck_tools_dialog ;;