aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorAmos Wenger2013-08-15 21:50:13 +0200
committerJack Nagel2013-08-19 13:35:44 -0500
commit13c2776795a4cb233924914b558bab9a5e4beea2 (patch)
tree3260352c9c7230683320294b612ba6e9738011a1 /Library/Homebrew/cmd
parent1c991b249ef58ba77f17431e108782b0adb7ceae (diff)
downloadhomebrew-13c2776795a4cb233924914b558bab9a5e4beea2.tar.bz2
Use File::PATH_SEPARATOR globally instead of ':'
On Unix, the path separator is ':', whereas on Windows, it is ';'. This is the first of a series of patch to bring macbrew's and winbrew's codebases closer together. The main places the magic constant ':' was being used were: - the $PATH environment variable - CMAKE-related environment variables - pkg-config related environment variables Closes #21921. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/doctor.rb4
-rw-r--r--Library/Homebrew/cmd/sh.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 18af768b4..c1921c975 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -42,7 +42,7 @@ class Checks
############# HELPERS
def paths
- @paths ||= ENV['PATH'].split(':').collect do |p|
+ @paths ||= ENV['PATH'].split(File::PATH_SEPARATOR).collect do |p|
begin
File.expand_path(p).chomp('/')
rescue ArgumentError
@@ -68,7 +68,7 @@ class Checks
# Sorry for the lack of an indent here, the diff would have been unreadable.
# See https://github.com/mxcl/homebrew/pull/9986
def check_path_for_trailing_slashes
- bad_paths = ENV['PATH'].split(':').select { |p| p[-1..-1] == '/' }
+ bad_paths = ENV['PATH'].split(File::PATH_SEPARATOR).select { |p| p[-1..-1] == '/' }
return if bad_paths.empty?
s = <<-EOS.undent
Some directories in your path end in a slash.
diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb
index a1ff30dfc..82fcc968d 100644
--- a/Library/Homebrew/cmd/sh.rb
+++ b/Library/Homebrew/cmd/sh.rb
@@ -12,7 +12,7 @@ module Homebrew extend self
ENV.setup_build_environment
if superenv?
# superenv stopped adding brew's bin but generally user's will want it
- ENV['PATH'] = ENV['PATH'].split(':').insert(1, "#{HOMEBREW_PREFIX}/bin").join(':')
+ ENV['PATH'] = ENV['PATH'].split(File::PATH_SEPARATOR).insert(1, "#{HOMEBREW_PREFIX}/bin").join(File::PATH_SEPARATOR)
end
ENV['PS1'] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ '
ENV['VERBOSE'] = '1'