From 52ace99f14a9390f5bf71370d616f2ed6b98c034 Mon Sep 17 00:00:00 2001 From: Amos Wenger Date: Thu, 15 Aug 2013 21:50:13 +0200 Subject: 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 Homebrew/homebrew#21921. Signed-off-by: Jack Nagel --- Library/Homebrew/cmd/doctor.rb | 4 ++-- Library/Homebrew/cmd/sh.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/cmd') 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' -- cgit v1.2.3