# -*- shell-script -*-
# /etc/X11/Xsession.d/25unburden-home-dir-xdg
# This file is sourced by Xsession(5), not executed.

if [ -z "$UNBURDEN_HOME_DIR_COMMON_SOURCED" ]; then
    if [ -e share/common.sh ]; then
        . share/common.sh
    elif [ -e /usr/pkg/libexec/unburden-home-dir/common.sh ]; then
        . /usr/pkg/libexec/unburden-home-dir/common.sh
    fi
fi

if unburden_it; then
    if [ -z "$XDG_CACHE_HOME" ]; then
        XDG_CACHE_HOME="${TARGETDIR:-${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}}/$(echo "${FILELAYOUT:-.unburden-%u/%s}" | sed -e "s/%u/$USER/;s/%s/cache/")"
        export XDG_CACHE_HOME
    fi
fi
