Show symlink target if linking fails

Closes Homebrew/homebrew#21060.
This commit is contained in:
Adam Vandenberg 2013-07-10 08:50:53 -07:00
parent ae9401291d
commit e805b8636c

View File

@ -208,19 +208,28 @@ class Keg < Pathname
def make_relative_symlink dst, src, mode=OpenStruct.new def make_relative_symlink dst, src, mode=OpenStruct.new
if dst.exist? and dst.realpath == src.realpath if dst.exist? and dst.realpath == src.realpath
puts "Skipping; already exists: #{dst}" if ARGV.verbose? puts "Skipping; already exists: #{dst}" if ARGV.verbose?
# cf. git-clean -n: list files to delete, don't really link or delete
elsif mode.dry_run and mode.overwrite
puts dst if dst.exist? or dst.symlink?
return return
end
# cf. git-clean -n: list files to delete, don't really link or delete
if mode.dry_run and mode.overwrite
if dst.symlink?
puts "#{dst} -> #{dst.resolved_path}"
elsif dst.exist?
puts dst
end
return
end
# list all link targets # list all link targets
elsif mode.dry_run if mode.dry_run
puts dst puts dst
return return
else end
dst.delete if mode.overwrite && (dst.exist? or dst.symlink?) dst.delete if mode.overwrite && (dst.exist? or dst.symlink?)
dst.make_relative_symlink src dst.make_relative_symlink src
end end
end
# symlinks the contents of self+foo recursively into #{HOMEBREW_PREFIX}/foo # symlinks the contents of self+foo recursively into #{HOMEBREW_PREFIX}/foo
def link_dir foo, mode=OpenStruct.new def link_dir foo, mode=OpenStruct.new