Because of the major reworking of how audiogame-manager works, had to almost completely rewrite the -r (remove game) function. Will be testing it quite a bit to make sure nothing is critically broken.
This commit is contained in:
@@ -101,18 +101,28 @@ game_removal() {
|
||||
local wineExec="${game#*|}"
|
||||
wineExec="${wineExec%|*}"
|
||||
wineExec="${wineExec##*\\}"
|
||||
# Confirm removal
|
||||
get_bottle "${game%|*}"
|
||||
# Make sure the game can be handled by remove
|
||||
if [[ "${HOME}/.local/wine/${game%|*}" == "${WINEPREFIX}" ]]; then
|
||||
read -rp "To remove the wine bottle \"${WINEPREFIX##*/}\" and all of its contents press enter. To cancel press control+c. " continue
|
||||
# With shared bottles, always remove only the game files, never the entire bottle
|
||||
create_game_array "$game"
|
||||
if [[ ${#game[@]} -gt 0 ]]; then
|
||||
# Set up wine environment for this game
|
||||
source .includes/bottle.sh
|
||||
get_bottle "${game[0]}"
|
||||
|
||||
read -rp "This will remove the game files for \"${game[2]}\" from the shared wine bottle. To continue press enter. To cancel press control+c. " continue
|
||||
|
||||
# kill any previous existing wineservers for this prefix in case they didn't shut down properly.
|
||||
wineserver -k
|
||||
# remove the game
|
||||
rm -rf "${WINEPREFIX}"
|
||||
else
|
||||
read -rp "This bottle \"${WINEPREFIX##*/}\" contains multiple entries, so only the game will be removed. To continue press enter. To cancel press control+c. " continue
|
||||
rm -rf "$(winepath "${winePath}")"
|
||||
|
||||
# Remove only the game's installation directory
|
||||
if [[ -n "$winePath" ]]; then
|
||||
local gameDir="$(winepath "$winePath")"
|
||||
if [[ -d "$gameDir" ]]; then
|
||||
echo "Removing game directory: $gameDir"
|
||||
rm -rf "$gameDir"
|
||||
else
|
||||
echo "Game directory not found, skipping file removal."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# remove the launcher
|
||||
gawk -i inplace -vLine="${game//\\/\\\\}" '!index($0,Line)' "$configFile"
|
||||
|
Reference in New Issue
Block a user