blob: f64197b93e448daa67bf94278b076ee9c7b49b4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
# direnv by default puts its cache in .direnv/ next to the .envrc.
# I rather have my caches in ~/.cache.
: "${XDG_CACHE_HOME:="${HOME}/.cache"}"
declare -A direnv_layout_dirs
direnv_layout_dir() {
local hash path
echo "${direnv_layout_dirs[$PWD]:=$(
hash="$(sha1sum - <<< "$PWD" | head -c40)"
path="${PWD//[^a-zA-Z0-9]/-}"
echo "${XDG_CACHE_HOME}/direnv/layouts/${hash}${path}"
)}"
}
|