diff --git a/linux-game-manager.sh b/linux-game-manager.sh index 7fc1220..24a3530 100755 --- a/linux-game-manager.sh +++ b/linux-game-manager.sh @@ -334,9 +334,20 @@ game_removal() { exit 0 fi fi - dialog --backtitle "Linux Game Manager" \ - --yesno "mThis will remove the directory \"${game%/*}\" and all of its contents. Do you want to continue?." -1 -1 --stdout || exit 0 - { rm -rfv "${game%/*}"; + local launcherPath="$(readlink -f "$0")" + launcherPath="${launcherPath%/*}" + local noRemove="no" + if [[ "${game%/*}" =~ ^$launcherPath ]] ; then + # The launcher is actually a script under lgm, do not remove. + noRemove="yes" + dialog --backtitle "Linux Game Manager" \ + --yesno "This will remove the game from your game list, but will not remove any files. Do you want to continue?." -1 -1 --stdout || exit 0 + else + dialog --backtitle "Linux Game Manager" \ + --yesno "mThis will remove the directory \"${game%/*}\" and all of its contents. Do you want to continue?." -1 -1 --stdout || exit 0 + fi + export noRemove + { [ "$noRemove" == "no" ] && rm -rfv "${game%/*}"; sed -i "/${game//\//\\/}/d" "$configFile"; } | dialog --backtitle "Linux Game Manager" --progressbox "Removing game..." -1 -1 exit 0 }