Respect ZDOTDIR environment variable iff set (#49913)
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
This commit is contained in:
1 parent
e128e1eade
commit
00250b90c6
1 file changed
+1
-1
+1
-1
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user