From 0242f7ccae800eab5c3ab5f3129b1126ffbb45c3 Mon Sep 17 00:00:00 2001 From: hsbt Date: Fri, 20 Oct 2017 07:03:11 +0000 Subject: Overwrite destination symlink file if `remove_destination` is set. [Bug #13914][ruby-core:82846] Patch by @mzp https://github.com/ruby/fileutils/pull/9 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/fileutils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/fileutils.rb') diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 37945b4096..adff31c944 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -412,7 +412,7 @@ module FileUtils def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false) Entry_.new(src, nil, dereference_root).wrap_traverse(proc do |ent| destent = Entry_.new(dest, ent.rel, false) - File.unlink destent.path if remove_destination && File.file?(destent.path) + File.unlink destent.path if remove_destination && (File.file?(destent.path) || File.symlink?(destent.path)) ent.copy destent.path end, proc do |ent| destent = Entry_.new(dest, ent.rel, false) -- cgit v1.2.3