aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/utils.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 41b9a4661..373320f75 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -589,25 +589,30 @@ def truncate_text_to_approximate_size(s, max_bytes, options = {})
out
end
-def link_path_manpages(path, command)
- return unless (path/"man").exist?
+def link_src_dst_dirs(src_dir, dst_dir, command)
+ return unless src_dir.exist?
conflicts = []
- (path/"man").find do |src|
+ src_dir.find do |src|
next if src.directory?
- dst = HOMEBREW_PREFIX/"share"/src.relative_path_from(path)
+ dst = dst_dir/src.relative_path_from(src_dir.parent)
next if dst.symlink? && src == dst.resolved_path
if dst.exist?
conflicts << dst
next
end
+ dst_dir.mkpath
dst.make_relative_symlink(src)
end
unless conflicts.empty?
onoe <<-EOS.undent
- Could not link #{name} manpages to:
+ Could not link:
#{conflicts.join("\n")}
Please delete these files and run `#{command}`.
EOS
end
end
+
+def link_path_manpages(path, command)
+ link_src_dst_dirs(path/"man", HOMEBREW_PREFIX/"share", command)
+end