diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 4791255d12..4a3fd2dddc 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -47,9 +47,7 @@ class Keg < Pathname dirs << dst if dst.directory? && !dst.symlink? # check whether the file to be unlinked is from the current keg first - if !dst.symlink? || !dst.exist? || src != dst.resolved_path - next - end + next if !dst.symlink? || !dst.exist? || src != dst.resolved_path dst.uninstall_info if dst.to_s =~ INFOFILE_RX and ENV['HOMEBREW_KEEP_INFO'] dst.unlink @@ -262,6 +260,15 @@ class Keg < Pathname make_relative_symlink dst, src, mode end elsif src.directory? + # If the `src` in the Cellar is a symlink itself, link it directly. + # For example Qt has `Frameworks/QtGui.framework -> lib/QtGui.framework` + # Not making a link here, would result in an empty dir because the + # `src` is not followed by `find`. + if src.symlink? && !dst.exist? + make_relative_symlink dst, src, mode + Find.prune + end + # if the dst dir already exists, then great! walk the rest of the tree tho next if dst.directory? and not dst.symlink? # no need to put .app bundles in the path, the user can just use