Skip to content

Commit

Permalink
lib/utilities: use $XDG_CACHE_HOME properly
Browse files Browse the repository at this point in the history
We should fall back to the default location, not use an entirely different one.
  • Loading branch information
gaelicWizard committed Feb 9, 2022
1 parent aa37f22 commit 36d1e2b
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 @@ -127,7 +127,7 @@ function _bash-it-component-help() {
function _bash-it-component-cache-file() {
local _component_to_cache _file_path _result="${2:-${FUNCNAME[0]//-/_}}"
_bash-it-component-pluralize "${1?${FUNCNAME[0]}: component name required}" _component_to_cache
_file_path="${XDG_CACHE_HOME:-${BASH_IT?}/tmp/cache}${XDG_CACHE_HOME:+/bash_it}/${_component_to_cache?}"
_file_path="${XDG_CACHE_HOME:-${HOME?}/.cache}/bash/${_component_to_cache?}"
[[ -f "${_file_path}" ]] || mkdir -p "${_file_path%/*}"
printf -v "${_result?}" '%s' "${_file_path}"
}
Expand Down Expand Up @@ -213,7 +213,7 @@ function _bash-it-component-item-is-enabled() {
component_type="${1}" item_name="${2}"
fi

for each_file in "${BASH_IT}/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${item_name}.${component_type}"*."bash" \
for each_file in "${BASH_IT?}/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${item_name}.${component_type}"*."bash" \
"${BASH_IT}/${component_type}"*/"enabled/${item_name}.${component_type}"*."bash" \
"${BASH_IT}/${component_type}"*/"enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${item_name}.${component_type}"*."bash"; do
[[ -f "${each_file}" ]] && return
Expand Down

0 comments on commit 36d1e2b

Please sign in to comment.