fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

NahorFix failing system tests on Cygwin440e7fcbc

master
1.2 KiB29 linesraw
1# localization: skip(private)
2function __fish_make_cache_dir --description "Create and return XDG_CACHE_HOME"
3    set -l xdg_cache_home $XDG_CACHE_HOME
4    if test -z "$xdg_cache_home"; or string match -qv '/*' -- $xdg_cache_home; or set -q xdg_cache_home[2]
5        set xdg_cache_home $HOME/.cache
6    end
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
11    if not path is -d $xdg_cache_home/fish/"$argv[1]"
12        set -l mkdir_options -m 700
13
14        # Can't set the permission in Cygwin on a `noacl` mount
15        if __fish_is_cygwin
16            # Find the first existing parent so we can `stat` it and get its mountpoint
17            set -l existing_parent $xdg_cache_home/fish/"$argv[1]"
18            while not path is -d $existing_parent
19                set existing_parent (path dirname $existing_parent)
20            end
21
22            if __fish_cygwin_noacl "$existing_parent"
23                set mkdir_options
24            end
25        end
26
27        mkdir $mkdir_options -p $xdg_cache_home/fish/"$argv[1]"
28    end; and echo $xdg_cache_home/fish/"$argv[1]"
29end