Finally fixed the repeating of iwads when launched through the game launcher.

This commit is contained in:
Storm Dragon 2024-08-27 21:13:26 -04:00
parent 9877a7b72a
commit c0bf989641

View File

@ -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