diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/keg.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index b9ca83953..8fdc78b4e 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -24,14 +24,15 @@ class Keg <Pathname def initialize path super path - raise "#{to_s} is not a valid keg" unless parent.parent == HOMEBREW_CELLAR + raise "#{to_s} is not a valid keg" unless parent.parent.realpath == HOMEBREW_CELLAR.realpath raise "#{to_s} is not a directory" unless directory? end # if path is a file in a keg then this will return the containing Keg object def self.for path + path = path.realpath while not path.root? - return Keg.new(path) if path.parent.parent == HOMEBREW_CELLAR + return Keg.new(path) if path.parent.parent == HOMEBREW_CELLAR.realpath path = path.parent.realpath # realpath() prevents root? failing end raise "#{path} is not inside a keg" |
