aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend/ENV/shared.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/extend/ENV/shared.rb')
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index 2cdc2f83a..6fa9b7778 100644
--- a/Library/Homebrew/extend/ENV/shared.rb
+++ b/Library/Homebrew/extend/ENV/shared.rb
@@ -1,6 +1,7 @@
require "formula"
require "compilers"
require "development_tools"
+require "PATH"
# Homebrew extends Ruby's `ENV` to make our code more readable.
# Implemented in {SharedEnvExtension} and either {Superenv} or
@@ -80,7 +81,7 @@ module SharedEnvExtension
end
def append_path(key, path)
- append key, path, File::PATH_SEPARATOR if File.directory? path
+ self[key] = PATH.new(self[key]).append(path)
end
# Prepends a directory to `PATH`.
@@ -92,7 +93,7 @@ module SharedEnvExtension
# (e.g. <pre>ENV.prepend_path "PATH", which("emacs").dirname</pre>)
def prepend_path(key, path)
return if %w[/usr/bin /bin /usr/sbin /sbin].include? path.to_s
- prepend key, path, File::PATH_SEPARATOR if File.directory? path
+ self[key] = PATH.new(self[key]).prepend(path)
end
def prepend_create_path(key, path)
@@ -196,7 +197,7 @@ module SharedEnvExtension
# @private
def userpaths!
- paths = self["PATH"].split(File::PATH_SEPARATOR)
+ paths = PATH.new(self["PATH"]).to_a
# put Superenv.bin and opt path at the first
new_paths = paths.select { |p| p.start_with?("#{HOMEBREW_REPOSITORY}/Library/ENV", "#{HOMEBREW_PREFIX}/opt") }
# XXX hot fix to prefer brewed stuff (e.g. python) over /usr/bin.
@@ -211,7 +212,7 @@ module SharedEnvExtension
nil
end
end - %w[/usr/X11/bin /opt/X11/bin]
- self["PATH"] = new_paths.uniq.join(File::PATH_SEPARATOR)
+ self["PATH"] = PATH.new(new_paths.uniq)
end
def fortran
@@ -244,7 +245,7 @@ module SharedEnvExtension
else
if (gfortran = which("gfortran", (HOMEBREW_PREFIX/"bin").to_s))
ohai "Using Homebrew-provided fortran compiler."
- elsif (gfortran = which("gfortran", ORIGINAL_PATHS.join(File::PATH_SEPARATOR)))
+ elsif (gfortran = which("gfortran", PATH.new(ORIGINAL_PATHS)))
ohai "Using a fortran compiler found at #{gfortran}."
end
if gfortran