Skip to content

Commit

Permalink
lib/utilities: XDG_CACHE_HOME
Browse files Browse the repository at this point in the history
Use $XDG_CACHE_HOME environment constant instead of placing a tmp/cache folder inside the bash-it data repo. If not defined, fall back to current behavior.

This resolves #1904.
  • Loading branch information
gaelicWizard committed Oct 18, 2021
1 parent 7cd0278 commit b986c39
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/utilities.bash
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ function _bash-it-component-help() {

function _bash-it-component-cache-file() {
local component file
component="$(_bash-it-pluralize-component "${1}")"
file="${BASH_IT?}/tmp/cache/${component}"
component="$(_bash-it-pluralize-component "${1?${FUNCNAME[0]}: component name required}")"
file="${XDG_CACHE_HOME:-${BASH_IT?}/tmp/cache}${XDG_CACHE_HOME:+/bash_it}/${component}"
[[ -f "${file}" ]] || mkdir -p "${file%/*}"
printf '%s' "${file}"
}
Expand Down

0 comments on commit b986c39

Please sign in to comment.