Permalink
Browse files

Create symlinks for the xdg dirs

  • Loading branch information...
1 parent 5153486 commit 9be256f76362a4f109890e033d9fc5467144f715 Ken VanDine committed Oct 27, 2017
Showing with 11 additions and 0 deletions.
  1. +11 −0 common/desktop-exports
View
@@ -74,6 +74,17 @@ fi
# Create $XDG_RUNTIME_DIR if not exists (to be removed when LP: #1656340 is fixed)
[ -n "$XDG_RUNTIME_DIR" ] && mkdir -p $XDG_RUNTIME_DIR -m 700
+# Create links for user-dirs.dirs
+REALHOME=`getent passwd $UID | cut -d ':' -f 6`
+test -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs && . ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs
+XDG_SPECIAL_DIRS=($XDG_DOCUMENTS_DIR $XDG_DESKTOP_DIR $XDG_DOWNLOAD_DIR $XDG_MUSIC_DIR $XDG_PICTURES_DIR $XDG_VIDEOS_DIR $XDG_PUBLIC_DIR $XDG_TEMPLATES_DIR)
+for d in ${XDG_SPECIAL_DIRS[@]}; do
+ b=$(basename "$d")
+ if [ -e $REALHOME/$b ] && [ ! -e $SNAP_USER_DATA/$b ]; then
+ ln -s $REALHOME/$b $SNAP_USER_DATA/$b
+ fi
+done
+
# If detect wayland server socket, then set environment so applications prefer
# wayland, and setup compat symlink (until we use user mounts. Remember,
# XDG_RUNTIME_DIR is /run/user/<uid>/snap.$SNAP so look in the parent directory

0 comments on commit 9be256f

Please sign in to comment.