From 989f1da158000a4eef5090f0583365727c5fd94b Mon Sep 17 00:00:00 2001 From: Juan Barbat Date: Wed, 4 Nov 2026 08:39:44 -0300 Subject: [PATCH] fix(zsh): move PATH entries to the front even when already present An inherited late ~/.local/bin (sshd, /etc/profile) was never moved, so on agent-gentle /usr/bin/gs (Ghostscript) shadowed gs. --- zsh/cortex-dotfiles.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zsh/cortex-dotfiles.zsh b/zsh/cortex-dotfiles.zsh index f27561a..77021a0 100644 --- a/zsh/cortex-dotfiles.zsh +++ b/zsh/cortex-dotfiles.zsh @@ -15,8 +15,12 @@ fi #endregion #region PATH +# Moves $1 to the front of PATH (adds it when missing). An entry inherited at the +# end of PATH (sshd, /etc/profile) must still win: on agent-gentle a late +# ~/.local/bin let /usr/bin/gs (Ghostscript) shadow gs. _cortex_dotfiles_path_prepend() { - [[ ":$PATH:" == *":$1:"* ]] || export PATH="$1:$PATH" + path=("$1" ${path:#$1}) + export PATH } # ~/.local/bin always, even before it exists (installers create it later).