fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
440e7fcbc
master
1# localization: skip(private) 2function __fish_make_cache_dir --description"Create and return XDG_CACHE_HOME" 3set -l xdg_cache_home$XDG_CACHE_HOME 4if test -z " $xdg_cache_home " ;or string match -qv'/*' --$xdg_cache_home ;or set -q xdg_cache_home[ 2 ] 5set xdg_cache_home$HOME /.cache 6end 7 8# If we get an argument, we try to create that as a subdirectory. 9# So if you call `__fish_make_cache_dir completions`, 10# this creates e.g. ~/.cache/fish/completions 11if not path is -d$xdg_cache_home /fish/" $argv [ 1 ] " 12set -l mkdir_options -m700 13 14# Can't set the permission in Cygwin on a `noacl` mount 15if __fish_is_cygwin 16# Find the first existing parent so we can `stat` it and get its mountpoint 17set -l existing_parent$xdg_cache_home /fish/" $argv [ 1 ] " 18while not path is -d$existing_parent 19set existing_parent( path dirname$existing_parent ) 20end 21 22if __fish_cygwin_noacl " $existing_parent " 23set mkdir_options 24end 25end 26 27mkdir $mkdir_options -p$xdg_cache_home /fish/" $argv [ 1 ] " 28end ;and echo $xdg_cache_home /fish/" $argv [ 1 ] " 29end