fix(bash): keep z_path fallback bash-3.2 clean (tr, not ${x,,})

The wslpath-absent fallback lowercased the drive letter with ${drive,,},
a bash-4.0 construct that breaks on macOS's stock bash 3.2. Use tr
instead so the whole helper stays 3.2-compatible.
This commit is contained in:
KellyMichels 2026-07-22 18:07:53 -05:00
parent 48a5e7f7d6
commit eedf549794

View File

@ -47,10 +47,12 @@ z_path() {
if command -v wslpath >/dev/null 2>&1; then
wslpath -u "$p" 2>/dev/null || printf '%s' "$p"
else
# Fallback when wslpath is absent: F:\a\b -> /mnt/f/a/b
local drive="${p%%:*}" rest="${p#*:}"
rest="${rest//\\//}"
printf '/mnt/%s%s' "${drive,,}" "$rest"
# Fallback when wslpath is absent: F:\a\b -> /mnt/f/a/b. Lowercase the
# drive via tr (not ${x,,}) so this stays bash-3.2 clean for macOS.
local drive rest
drive="$(printf '%s' "${p%%:*}" | tr '[:upper:]' '[:lower:]')"
rest="${p#*:}"; rest="${rest//\\//}"
printf '/mnt/%s%s' "$drive" "$rest"
fi
;;
*) printf '%s' "$p" ;;