mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-09-29 05:02:45 +00:00
15
nvm.sh
15
nvm.sh
@@ -2041,16 +2041,31 @@ nvm_is_natural_num() {
|
||||
|
||||
# Check version dir permissions
|
||||
nvm_check_file_permissions() {
|
||||
local ZSH_HAS_NONOMATCH_UNSET
|
||||
ZSH_HAS_NONOMATCH_UNSET=1
|
||||
if nvm_has "setopt"; then
|
||||
ZSH_HAS_NONOMATCH_UNSET="$(set +e ; setopt | nvm_grep nonomatch > /dev/null ; nvm_echo $?)"
|
||||
setopt nonomatch
|
||||
fi
|
||||
for FILE in $1/* $1/.[!.]* $1/..?* ; do
|
||||
if [ -d "$FILE" ]; then
|
||||
if ! nvm_check_file_permissions "$FILE"; then
|
||||
if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
|
||||
setopt nomatch
|
||||
fi
|
||||
return 2
|
||||
fi
|
||||
elif [ -e "$FILE" ] && [ ! -w "$FILE" ]; then
|
||||
nvm_err "file is not writable: $(nvm_sanitize_path "$FILE")"
|
||||
if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
|
||||
setopt nomatch
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
|
||||
setopt nomatch
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user