From 5ef5db4cd05636d64647265227c198448d5f4995 Mon Sep 17 00:00:00 2001
From: icenine451 <benjamin.r.shelton@protonmail.com>
Date: Sat, 10 Feb 2024 09:49:52 -0500
Subject: [PATCH 1/2] Fix controller profile copying on update

---
 functions/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/functions/functions.sh b/functions/functions.sh
index d16f60c6..cd07f45e 100644
--- a/functions/functions.sh
+++ b/functions/functions.sh
@@ -467,7 +467,7 @@ install_retrodeck_controller_profile() {
   # USAGE: install_retrodeck_controller_profile
   if [[ -d "$HOME/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/" && -d "$HOME/.steam/steam/controller_base/templates/" ]]; then
     rsync -rlD --mkpath "/app/retrodeck/binding_icons/" "$HOME/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/"
-    cp -f "$emuconfigs/defaults/retrodeck/controller_configs/*.vdf" "$HOME/.steam/steam/controller_base/templates"
+    rsync -rlD --mkpath "$emuconfigs/defaults/retrodeck/controller_configs/" "$HOME/.steam/steam/controller_base/templates/"
   else
     configurator_generic_dialog "RetroDECK Controller Profile Install" "The target directories for the controller profile do not exist.\n\nThis may happen if you do not have Steam installed or the location is does not have permission to be read."
   fi

From 5c22bf321621866049340ce66e5125ecdcf1133b Mon Sep 17 00:00:00 2001
From: icenine451 <benjamin.r.shelton@protonmail.com>
Date: Sat, 10 Feb 2024 09:56:28 -0500
Subject: [PATCH 2/2] One-off forced refresh of controller profiles in same
 version

---
 retrodeck.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/retrodeck.sh b/retrodeck.sh
index daeb3cc8..254d383f 100644
--- a/retrodeck.sh
+++ b/retrodeck.sh
@@ -189,6 +189,12 @@ if [[ $update_check == "true" ]]; then
   fi
 fi
 
+# THIS IS A ONE-OFF FORCED REFRESH OF RETRODECK CONTROLLER PROFILES IN A 0.7.6b VERSION REFRESH - REMOVE BEFORE NEXT VERSION RELEASE
+if [[ -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf" ]]; then # If RetroDECK controller profile has been previously installed
+  install_retrodeck_controller_profile
+fi
+# REMOVE BEFORE NEXT VERSION RELEASE
+
 # Normal Startup
 
 start_retrodeck