aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index edc540c45..83b8ba342 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -190,10 +190,10 @@ module Homebrew
Gem::Specification.reset
# Add Gem binary directory and (if missing) Ruby binary directory to PATH.
- path = ENV["PATH"].split(File::PATH_SEPARATOR)
- path.unshift(RUBY_BIN) if which("ruby") != RUBY_PATH
- path.unshift(Gem.bindir)
- ENV["PATH"] = path.join(File::PATH_SEPARATOR)
+ path = PATH.new(ENV["PATH"])
+ path.prepend(RUBY_BIN) if which("ruby") != RUBY_PATH
+ path.prepend(Gem.bindir)
+ ENV["PATH"] = path.existing
if Gem::Specification.find_all_by_name(name, version).empty?
ohai "Installing or updating '#{name}' gem"
@@ -293,7 +293,7 @@ def quiet_system(cmd, *args)
end
def which(cmd, path = ENV["PATH"])
- path.split(File::PATH_SEPARATOR).each do |p|
+ PATH.new(path).each do |p|
begin
pcmd = File.expand_path(cmd, p)
rescue ArgumentError
@@ -307,7 +307,7 @@ def which(cmd, path = ENV["PATH"])
end
def which_all(cmd, path = ENV["PATH"])
- path.to_s.split(File::PATH_SEPARATOR).map do |p|
+ PATH.new(path).map do |p|
begin
pcmd = File.expand_path(cmd, p)
rescue ArgumentError
@@ -416,7 +416,7 @@ def nostdout
end
def paths(env_path = ENV["PATH"])
- @paths ||= env_path.split(File::PATH_SEPARATOR).collect do |p|
+ @paths ||= PATH.new(env_path).collect do |p|
begin
File.expand_path(p).chomp("/")
rescue ArgumentError