From c0bf989641ae8814d44370345ed79f4bb2186229 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 27 Aug 2024 21:13:26 -0400 Subject: [PATCH] Finally fixed the repeating of iwads when launched through the game launcher. --- .scripts/yadoom | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.scripts/yadoom b/.scripts/yadoom index ea2f1bf..dd5483d 100755 --- a/.scripts/yadoom +++ b/.scripts/yadoom @@ -19,17 +19,18 @@ is_iwad() { iwad_menu() { # Extract the Path= lines from the [IWADSearch.Directories] section mapfile -t wadPaths < <(sed -n "/^\[IWADSearch.Directories\]/,/^\[/{/Path=/p;}" "$configFile" | cut -d '=' -f 2) - declare -a wadList - # Loop through each path in wadPaths and find WAD files + declare -A uniqueWads for i in "${wadPaths[@]}"; do - # Use find and append results to wadList array if [[ -d "$i" ]]; then while IFS= read -r -d $'\0' wad; do - is_iwad "$wad" && wadList+=("$wad") + if is_iwad "$wad"; then + wad_name=$(basename "$wad") + uniqueWads["${wad_name,,}"]="$wad" + fi done < <(find "$i" -follow -maxdepth 1 -type f \( -iname '*.wad' -o -iname '*.ipk3' \) -print0) fi done - + wadList=("${uniqueWads[@]}") # Set up the menu declare -a wadMenu for path in "${wadList[@]}" ; do