From e536497d3f01d246cd04031ec2fb787533d655f0 Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Wed, 8 Mar 2017 08:38:47 +0100 Subject: [PATCH] Append flatpak data dirs if XDG_DATA_DIRS is already set (#611) * Append flatpak data dirs if XDG_DATA_DIRS is already set Otherwise it will be impossible to run flatpak apps from desktop menus. This issue can happen if another app (e.g. snapd) wants to add custom folders to XDG_DATA_DIRS through /etc/profile.d If XDG_DATA_DIRS is empty or unset, define it as before. Fixes #606 (cherry picked from commit a9acdc0532210edc1670e31f7e9ce4d889893685) --- profile/flatpak.sh.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/profile/flatpak.sh.in b/profile/flatpak.sh.in index 34a21b3f..74e62f6a 100644 --- a/profile/flatpak.sh.in +++ b/profile/flatpak.sh.in @@ -1,4 +1,11 @@ # @sysconfdir@/profile.d/flatpak.sh - set XDG_DATA_DIRS -XDG_DATA_DIRS="${XDG_DATA_DIRS:-$HOME/.local/share/flatpak/exports/share:@localstatedir@/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/}" +flatpak_dirs=$HOME/.local/share/flatpak/exports/share/:@localstatedir@/lib/flatpak/exports/share/ + +if [ -z "${XDG_DATA_DIRS}" ]; then + XDG_DATA_DIRS="$flatpak_dirs:/usr/local/share/:/usr/share/" +else + XDG_DATA_DIRS="$XDG_DATA_DIRS:$flatpak_dirs" +fi + export XDG_DATA_DIRS