From e55bb2f9b9f111ebfe6a5277be62056f277633f9 Mon Sep 17 00:00:00 2001
From: icenine451 <59938822+icenine451@users.noreply.github.com>
Date: Wed, 15 Mar 2023 19:58:02 -0400
Subject: [PATCH 1/2] New rd_cpnf variables not loaded correctly after update

---
 functions.sh   | 1 -
 post_update.sh | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/functions.sh b/functions.sh
index b17d2716..552044ef 100644
--- a/functions.sh
+++ b/functions.sh
@@ -629,7 +629,6 @@ update_rd_conf() {
   deploy_single_patch $rd_defaults $rd_update_patch $rd_conf
   set_setting_value $rd_conf "version" "$hard_version" retrodeck # Set version of currently running RetroDECK to updated retrodeck.cfg
   rm -f $rd_update_patch # Cleanup temporary patch file
-  source $rd_conf # Load new config file variables
 }
 
 conf_write() {
diff --git a/post_update.sh b/post_update.sh
index cc469cec..6626019a 100644
--- a/post_update.sh
+++ b/post_update.sh
@@ -187,7 +187,7 @@ post_update() {
     # - Primehack preconfiguration completely redone. "Stop emulation" hotkey set to Start+Select, Xbox and Nintendo keymap profiles were created, Xbox set as default.
     # - Duckstation save and state locations were dir_prep'd to the rdhome/save and /state folders, which was not previously done. Much safer now!
     # - Fix PICO-8 folder structure. ROM and save folders are now sane and binary files will go into ~/retrodeck/bios/pico-8/
-    
+
     rm -rf /var/config/primehack # Purge old Primehack config files. Saves are safe as they are linked into /var/data/primehack.
     primehack_init
 
@@ -209,6 +209,6 @@ post_update() {
   --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
   --title "RetroDECK Finishing Upgrade" \
   --text="RetroDECK is finishing the upgrade process, please wait."
-
+  source $rd_conf # Load new config file variables
   create_lock
 }
\ No newline at end of file

From 47a754662aaa8cfe6936d5fa9bc733febf2248cb Mon Sep 17 00:00:00 2001
From: icenine451 <59938822+icenine451@users.noreply.github.com>
Date: Wed, 15 Mar 2023 20:01:53 -0400
Subject: [PATCH 2/2] dir_prep doesn't translate ~ correctly apparently

---
 functions.sh   | 2 +-
 post_update.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/functions.sh b/functions.sh
index 552044ef..b098379e 100644
--- a/functions.sh
+++ b/functions.sh
@@ -1313,7 +1313,7 @@ finit() {
   dir_prep "$themes_folder" "/var/config/emulationstation/.emulationstation/themes"
 
   # PICO-8
-  dir_prep "$bios_folder/pico-8" "~/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
+  dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
   dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway)
   dir_prep "$bios_folder/pico-8/cdata" "$saves_folder/pico-8" # PICO-8 saves folder
 
diff --git a/post_update.sh b/post_update.sh
index 6626019a..78d675c0 100644
--- a/post_update.sh
+++ b/post_update.sh
@@ -195,7 +195,7 @@ post_update() {
     dir_prep "$rdhome/states/duckstation" "/var/data/duckstation/savestates"
 
     mv "$bios_folder/pico8" "$bios_folder/pico8_olddata" # Move legacy (and incorrect / non-functional ) PICO-8 location for future cleanup / less confusion
-    dir_prep "$bios_folder/pico-8" "~/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
+    dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
     dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway)
     dir_prep "$bios_folder/pico-8/cdata" "$saves_folder/pico-8" # PICO-8 saves folder
   fi