Fixed an error in game removal. Fixed an error where it would try to launch an empty file name if escape were pressed to close the menu.
This commit is contained in:
@@ -96,13 +96,16 @@ game_removal() {
|
||||
open_url "https://2mb.games/product/2mb-patron/"
|
||||
exit 0
|
||||
fi
|
||||
# Parse game info before create_game_array overwrites $game
|
||||
local selectedGame="$game"
|
||||
local winePath="${game#*|}"
|
||||
export winePath="${winePath%\\*.exe}"
|
||||
local wineExec="${game#*|}"
|
||||
wineExec="${wineExec%|*}"
|
||||
wineExec="${wineExec##*\\}"
|
||||
|
||||
# With shared bottles, always remove only the game files, never the entire bottle
|
||||
create_game_array "$game"
|
||||
create_game_array "$selectedGame"
|
||||
if [[ ${#game[@]} -gt 0 ]]; then
|
||||
# Set up wine environment for this game
|
||||
source .includes/bottle.sh
|
||||
@@ -126,9 +129,9 @@ game_removal() {
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# remove the launcher
|
||||
gawk -i inplace -vLine="${game//\\/\\\\}" '!index($0,Line)' "$configFile"
|
||||
echo "The selected item has been deleted."
|
||||
# remove the launcher using the original selected game info
|
||||
gawk -i inplace -vLine="${selectedGame//\\/\\\\}" '!index($0,Line)' "$configFile"
|
||||
agm_msgbox "Game Removal" "" "\"${game[2]}\" has been successfully removed."
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
@@ -314,6 +317,12 @@ game_launcher() {
|
||||
source .includes/help.sh # Make available in this function
|
||||
documentation "$game" "$(echo "$game" | cut -d '|' -f2)"
|
||||
fi
|
||||
|
||||
# Safety check: don't proceed if game is empty
|
||||
if [[ -z "$game" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
create_game_array "$game"
|
||||
else
|
||||
create_game_array "$game"
|
||||
|
Reference in New Issue
Block a user