From d4da28357f193bd2d44eb5bd50ff877b8742b22c Mon Sep 17 00:00:00 2001 From: Sergio Schvezov Date: Fri, 21 Feb 2020 17:26:57 -0300 Subject: [PATCH] snap launcher: avoid exporting XDG_CACHE_HOME Exporting XDG_CACHE_HOME affects applications launched from within the context of code. Rename it to GDK_CACHE_DIR and do not export it. Also test for existence before creating to avoid shelling out to mkdir if not needed. Signed-off-by: Sergio Schvezov --- resources/linux/snap/electron-launch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/linux/snap/electron-launch b/resources/linux/snap/electron-launch index 8a294975147..9f4eb6a23b8 100755 --- a/resources/linux/snap/electron-launch +++ b/resources/linux/snap/electron-launch @@ -14,15 +14,15 @@ else ARCH="$SNAP_ARCH-linux-gnu" fi -export XDG_CACHE_HOME="$SNAP_USER_COMMON/.cache" -if [[ -d "$SNAP_USER_DATA/.cache" && ! -e "$XDG_CACHE_HOME" ]]; then +GDK_CACHE_DIR="$SNAP_USER_COMMON/.cache" +if [[ -d "$SNAP_USER_DATA/.cache" && ! -e "$GDK_CACHE_DIR" ]]; then # the .cache directory used to be stored under $SNAP_USER_DATA, migrate it mv "$SNAP_USER_DATA/.cache" "$SNAP_USER_COMMON/" fi -mkdir -p "$XDG_CACHE_HOME" +[ ! -d "$GDK_CACHE_DIR" ] && mkdir -p "$GDK_CACHE_DIR" # Gdk-pixbuf loaders -export GDK_PIXBUF_MODULE_FILE="$XDG_CACHE_HOME/gdk-pixbuf-loaders.cache" +export GDK_PIXBUF_MODULE_FILE="$GDK_CACHE_DIR/gdk-pixbuf-loaders.cache" export GDK_PIXBUF_MODULEDIR="$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders" if [ -f "$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" ]; then "$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" > "$GDK_PIXBUF_MODULE_FILE"