mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Read ZDOTDIR environment variable
This commit is contained in:
parent
dce94717a9
commit
4ac57d85b2
@ -21,13 +21,13 @@ RSpec.describe Utils::Shell do
|
||||
|
||||
it "returns /tmp/.zshrc for Zsh if ZDOTDIR is /tmp" do
|
||||
ENV["SHELL"] = "/bin/zsh"
|
||||
ENV["ZDOTDIR"] = "/tmp"
|
||||
ENV["HOMEBREW_ZDOTDIR"] = "/tmp"
|
||||
expect(described_class.profile).to eq("/tmp/.zshrc")
|
||||
end
|
||||
|
||||
it "returns ~/.zshrc for Zsh" do
|
||||
ENV["SHELL"] = "/bin/zsh"
|
||||
ENV["ZDOTDIR"] = nil
|
||||
ENV["HOMEBREW_ZDOTDIR"] = nil
|
||||
expect(described_class.profile).to eq("~/.zshrc")
|
||||
end
|
||||
|
||||
|
@ -60,7 +60,7 @@ module Utils
|
||||
rc_profile = "#{Dir.home}/.rcrc"
|
||||
return rc_profile if File.exist? rc_profile
|
||||
when :zsh
|
||||
return "#{ENV["ZDOTDIR"]}/.zshrc" if ENV["ZDOTDIR"].present?
|
||||
return "#{ENV["HOMEBREW_ZDOTDIR"]}/.zshrc" if ENV["HOMEBREW_ZDOTDIR"].present?
|
||||
end
|
||||
|
||||
SHELL_PROFILE_MAP.fetch(preferred, "~/.profile")
|
||||
|
Loading…
x
Reference in New Issue
Block a user