EmuDeck/functions/uninstallEmuFP.sh
rawdatafeel d7913c6038 Uninstall: Fix find errors (#1277)
* If these folders do not exist, find fails, test if they exist first

fix cache folder

logs

fix parsers rom library

rom library .reset

Revert "rom library .reset"

This reverts commit d3f76bb8c18c0b5223e83f3932c55b52b97d89cf.

ignore emulators folder

-p

cleaner name

fuzzy fuzzy
2024-09-26 12:26:48 +02:00

44 lines
1.2 KiB
Bash

#!/bin/bash
uninstallEmuFP() {
name=$1
ID=$2
type=$3
scriptname="$4"
if [[ "$type" == "emulator" ]]; then
launcherPath="${toolsPath}/launchers"
elif [[ "$type" == "remoteplay" ]]; then
launcherPath="${romsPath}/remoteplay"
elif [[ "$type" == "genericapplication" ]]; then
launcherPath="${romsPath}/generic-applications"
fi
if [[ -z "$scriptname" ]]; then
scriptname="$name"
fi
echo "1, Flatpak Name: $name"
echo "2, Flatpak ID: $ID"
echo "3, Flatpak Type: $type"
echo "4, Flatpak Script Name: $scriptname"
flatpak uninstall "$ID" -y --user
flatpak uninstall "$ID" -y --system
shName=$(echo "$scriptname" | awk '{print tolower($0)}')
for romfolder in "${launcherPath}/" "${romsPath}/emulators" "${romsPath}/desktop/remoteplay" "${romsPath}/desktop/generic-applications"; do
if [ -d "$romfolder" ]; then
find "$romfolder" -maxdepth 1 -type f \( -iname "$shName.sh" -o -iname "$shName-emu.sh" \) | \
while read -r f; do
echo "deleting $f"
rm -f "$f"
done
else
echo "Skipping. $romfolder does not exist."
fi
done
}