mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 18:03:37 +08:00
7e087d8eda
This will move all current cache uses to e.g. ~/.cache/fish/ That's better anyway because it makes it easier to remove. Also it allows supplying a subdir so you can do `__fish_make_cache_dir completions` to get ~/.cache/fish/completions.
13 lines
557 B
Fish
13 lines
557 B
Fish
function __fish_make_cache_dir --description "Create and return XDG_CACHE_HOME"
|
|
set -l xdg_cache_home $XDG_CACHE_HOME
|
|
if test -z "$xdg_cache_home"; or string match -qv '/*' -- $xdg_cache_home; or set -q xdg_cache_home[2]
|
|
set xdg_cache_home $HOME/.cache
|
|
end
|
|
|
|
# If we get an argument, we try to create that as a subdirectory.
|
|
# So if you call `__fish_make_cache_dir completions`,
|
|
# this creates e.g. ~/.cache/fish/completions
|
|
mkdir -m 700 -p $xdg_cache_home/fish/"$argv[1]"
|
|
and echo $xdg_cache_home/fish/"$argv[1]"
|
|
end
|