From fdb438ce66fe01945f2b903bcb50f8bd3e8a6014 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 29 Jun 2014 19:19:24 -0500 Subject: Normalize paths before calling Tab.from_file --- Library/Homebrew/tab.rb | 12 ++++++++++-- Library/Homebrew/test/test_tab.rb | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'Library') 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 -- cgit v1.2.3