From e14f6e764eab1bd8acf10084f6f9bfe59d456abd Mon Sep 17 00:00:00 2001 From: Kunall Banerjee Date: Mon, 23 Feb 2026 13:04:16 -0500 Subject: [PATCH] Respect `ZDOTDIR` environment variable iff set (#49913) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When `ZDOTDIR` is set, `zsh` reads its configuration from that directory instead of the user’s `$HOME` directory. | Setup | `ZDOTDIR` set? | Script writes to | Zsh reads from | Match? | |---|---|---|---|---| | XDG + `ZDOTDIR` | ✅ | `$ZDOTDIR/.zshrc` | `$ZDOTDIR/.zshrc` | ✅ | | XDG without `ZDOTDIR` | ❌ | `$HOME/.zshrc` | `$HOME/.zshrc` | ✅ | | No XDG at all | ❌ | `$HOME/.zshrc` | `$HOME/.zshrc` | ✅ | Ref: https://zsh.sourceforge.io/Intro/intro_3.html Release Notes: - N/A --- script/cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cargo b/script/cargo index 0eb8e927d71c8a404b7ec723d7e7bbae8f482fed..8226a2becdbbcc27e5ad01b27f8479fea706fa5d 100755 --- a/script/cargo +++ b/script/cargo @@ -53,7 +53,7 @@ function getShellConfigPath(shell) { const home = os.homedir(); switch (shell) { case "zsh": - return path.join(home, ".zshrc"); + return path.join(process.env.ZDOTDIR || home, ".zshrc"); case "bash": // Prefer .bashrc, fall back to .bash_profile const bashrc = path.join(home, ".bashrc");