aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/extend/pathname.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 1f384db73..1f6d6695d 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -386,6 +386,18 @@ class Pathname
end
end
+ if RUBY_VERSION <= "1.8.7"
+ alias_method :old_chop_basename, :chop_basename
+ def chop_basename(path)
+ base = File.basename(path)
+ if /\A#{Pathname::SEPARATOR_PAT}?\z/o =~ base
+ return nil
+ else
+ return path[0, path.rindex(base)], base
+ end
+ end
+ private :chop_basename
+ end
end
# sets $n and $d so you can observe creation of stuff