Skip to content

Commit b6c0e52

Browse files
committed
Make sure tempdir can be attributed to mounted AppImage
1 parent 696358d commit b6c0e52

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

linuxdeploy-plugin-gtk.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,16 @@ cat > "$HOOKFILE" <<\EOF
181181
182182
gsettings get org.gnome.desktop.interface gtk-theme 2> /dev/null | grep -qi "dark" && GTK_THEME_VARIANT="dark" || GTK_THEME_VARIANT="light"
183183
APPIMAGE_GTK_THEME="${APPIMAGE_GTK_THEME:-"Adwaita:$GTK_THEME_VARIANT"}" # Allow user to override theme (discouraged)
184-
CACHEDIR="$(mktemp -d /tmp/.AppRun.XXXXXXXX)"
184+
185+
# in case we run from an AppImage, we use the $APPDIR environment variable as a template for the temporary directory that should be created
186+
# this allows users to attribute the tempdir to the running AppImage
187+
if [[ "$APPDIR" != "" ]]; then
188+
tempdir_template="$APPDIR".ld-p-gtk-tmp
189+
else
190+
tempdir_template=/tmp/.ld-p-gtk-tmp-XXXXXX
191+
fi
192+
193+
CACHEDIR="$(mktemp -d "$tempdir_template")"
185194
186195
export APPDIR="${APPDIR:-"$(dirname "$(realpath "$0")")"}" # Workaround to run extracted AppImage
187196
export GTK_DATA_PREFIX="$APPDIR"

0 commit comments

Comments
 (0)