Description: Use xdg-user-dir to specify Desktop directory
 Desktop directory was hardcoded to ~/Desktop, but that path
 will change depending on the user's language.
 .
 With this patch we user xdg-user-dir to set the Desktop directory
 so that it's correct regardless of language.
Author: Jonathan Carter <jcc@debian.org>
Bug-Debian: https://bugs.debian.org/959541
Last-Update: 2020-07-15

--- calamares-settings-debian-10.0.20.orig/add-calamares-desktop-icon
+++ calamares-settings-debian-10.0.20/add-calamares-desktop-icon
@@ -2,24 +2,26 @@
 # Creates an "Install Debian" icon on the live session tested with:
 # Xfce, LXDE, LXqt, Gnome, KDE, Mate, Cinnamon
 
+# We query xdg-user-dir because the Desktop directory has different
+# names for different languages
+DESKTOP=$(xdg-user-dir DESKTOP)
 
 # Create ~/Desktop just in case this runs before the xdg folder
 # creation script.
-mkdir -p ~/Desktop
-
+mkdir -p $DESKTOP
 
 # Among the Debian desktop environments, LXDE is the only one
 # that behaves completely different.
 if [ -f /usr/bin/lxsession ]; then
-    echo "[Desktop Entry]" > ~/Desktop/install-debian.desktop
-    echo "Type=Link" >> ~/Desktop/install-debian.desktop
-    echo "Name=Install Debian" >> ~/Desktop/install-debian.desktop
-    echo "Icon=install-debian" >> ~/Desktop/install-debian.desktop
+    echo "[Desktop Entry]" > $DESKTOP/install-debian.desktop
+    echo "Type=Link" >> $DESKTOP/install-debian.desktop
+    echo "Name=Install Debian" >> $DESKTOP/install-debian.desktop
+    echo "Icon=install-debian" >> $DESKTOP/install-debian.desktop
     echo "URL=/usr/share/applications/install-debian.desktop" \
-          >> ~/Desktop/install-debian.desktop
+          >> $DESKTOP/install-debian.desktop
 else
-    cp /usr/share/applications/install-debian.desktop ~/Desktop
+    cp /usr/share/applications/install-debian.desktop $DESKTOP
     # Xfce needs this executable otherwise it complains, everything
     # else doesn't seem to care either way.
-    chmod +x ~/Desktop/install-debian.desktop
+    chmod +x $DESKTOP/install-debian.desktop
 fi
