aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-06-29 19:19:24 -0500
committerJack Nagel2014-06-29 21:50:08 -0500
commitfdb438ce66fe01945f2b903bcb50f8bd3e8a6014 (patch)
tree3550108bd037d8c42d719b103a473580aee99277 /Library
parent76cd5b2ec745b3a298a790a9274065945c12ddaf (diff)
downloadhomebrew-fdb438ce66fe01945f2b903bcb50f8bd3e8a6014.tar.bz2
Normalize paths before calling Tab.from_file
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/tab.rb12
-rw-r--r--Library/Homebrew/test/test_tab.rb1
2 files changed, 10 insertions, 3 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index 351c77afb..868944cbc 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -32,7 +32,7 @@ class Tab < OpenStruct
def self.from_file path
tab = Tab.new Utils::JSON.load(File.read(path))
- tab.tabfile = path.realpath
+ tab.tabfile = path
tab
end
@@ -51,7 +51,15 @@ class Tab < OpenStruct
end
def self.for_formula f
- paths = [f.opt_prefix, f.linked_keg]
+ paths = []
+
+ if f.opt_prefix.symlink? && f.opt_prefix.directory?
+ paths << f.opt_prefix.resolved_path
+ end
+
+ if f.linked_keg.symlink? && f.linked_keg.directory?
+ paths << f.linked_keg.resolved_path
+ end
if f.rack.directory? && (dirs = f.rack.subdirs).length == 1
paths << dirs.first
diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb
index 912a207a9..296f9961f 100644
--- a/Library/Homebrew/test/test_tab.rb
+++ b/Library/Homebrew/test/test_tab.rb
@@ -93,7 +93,6 @@ class TabLoadingTests < Homebrew::TestCase
@f.prefix.mkpath
@path = @f.prefix.join(Tab::FILENAME)
@path.write Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt.json").read
- @path = @path.realpath
end
def teardown