tmp: Use XDG spec for Templates dir

This commit is contained in:
Salt 2019-02-10 12:20:05 -06:00
parent d0f8eda505
commit 6637e750c9

9
tmp
View File

@ -52,13 +52,20 @@ done
# Copy in template directory # Copy in template directory
if [ -n "$1" ]; then if [ -n "$1" ]; then
copydir="$HOME/Templates/tmp/$1" # Source in XDG dirs, if they exist
userdirs="${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs"
if [ -f "$userdirs" ]; then
source "$userdirs"
fi
unset userdirs
copydir="${XDG_TEMPLATES_DIR:-~/Templates}/tmp/$1"
if [ -d "$copydir" ]; then if [ -d "$copydir" ]; then
log "Using template \"$1\"" log "Using template \"$1\""
cp -r "$copydir"/* "$tmpdir" cp -r "$copydir"/* "$tmpdir"
else else
log "Could not find template directory \"$copydir\"" log "Could not find template directory \"$copydir\""
fi fi
unset copydir
fi fi
trap "cleanup" EXIT trap "cleanup" EXIT