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
commit52ace99f14a9390f5bf71370d616f2ed6b98c034 (patch)
tree48580569d443ddbebf2a06f99efb3a0ebe94208a /Library/Homebrew/cmd
parent809a52a6a3e8b0899aa2697f767b8dcc22210bd8 (diff)
downloadbrew-52ace99f14a9390f5bf71370d616f2ed6b98c034.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 Homebrew/homebrew#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'