Fixed create_game_array function.

This commit is contained in:
Storm Dragon 2025-05-20 17:51:20 -04:00
parent d9ef202b33
commit 6526d40c68

View File

@ -278,10 +278,13 @@ process_launcher-flags() {
create_game_array() { create_game_array() {
# Game array 0 bottle, 1 path, 2 title, 3+ flags # Game array 0 bottle, 1 path, 2 title, 3+ flags
game="$1"
for i in "${lines[@]}" ; do for i in "${lines[@]}" ; do
# Escape pipe characters in both strings for regex matching # Only compare the launcher section
if [[ "${i//|/\\|}" =~ ^${game//|/\\|}$ ]]; then j="${game#*|}"
game="$i" k="${i#*|}"
k="${k%%|*}"
if [[ "$j" == "$k" ]]; then
IFS='|' read -ra game <<< "$i" IFS='|' read -ra game <<< "$i"
break break
fi fi
@ -330,9 +333,9 @@ game_launcher() {
source .includes/help.sh # Make available in this function source .includes/help.sh # Make available in this function
documentation "$game" "$(echo "$game" | cut -d '|' -f2)" documentation "$game" "$(echo "$game" | cut -d '|' -f2)"
fi fi
create_game_array create_game_array "$game"
else else
create_game_array create_game_array "$game"
if [[ -z "$game" ]]; then if [[ -z "$game" ]]; then
echo "Game $1 not found." echo "Game $1 not found."
exit 1 exit 1