mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-28 04:51:15 -03:00
The main changes are: - disabling some checks related to POSIX file permissions when a filesystem is mounted with "noacl" (default on MSYS2) - disabling some checks related to symlinks when using fake ones (file copy) Windows with acl hasn't been tested because 1) Cygwin itself does not have any Rust package yet to compile fish, and 2) MSYS2 defaults to `noacl` Part of #12171
30 lines
1.2 KiB
Fish
30 lines
1.2 KiB
Fish
# localization: skip(private)
|
|
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
|
|
if not path is -d $xdg_cache_home/fish/"$argv[1]"
|
|
set -l mkdir_options -m 700
|
|
|
|
# Can't set the permission in Cygwin on a `noacl` mount
|
|
if __fish_is_cygwin
|
|
# Find the first existing parent so we can `stat` it and get its mountpoint
|
|
set -l existing_parent $xdg_cache_home/fish/"$argv[1]"
|
|
while not path is -d $existing_parent
|
|
set existing_parent (path dirname $existing_parent)
|
|
end
|
|
|
|
if __fish_cygwin_noacl "$existing_parent"
|
|
set mkdir_options
|
|
end
|
|
end
|
|
|
|
mkdir $mkdir_options -p $xdg_cache_home/fish/"$argv[1]"
|
|
end; and echo $xdg_cache_home/fish/"$argv[1]"
|
|
end
|