diff options
-rw-r--r-- | lib/chef/provider/link.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/chef/provider/link.rb b/lib/chef/provider/link.rb index 5fce97e5b3..16d30319b3 100644 --- a/lib/chef/provider/link.rb +++ b/lib/chef/provider/link.rb @@ -141,9 +141,16 @@ class Chef def action_delete if @current_resource.to # Exists - converge_by("delete link at #{@new_resource.target_file}") do - ::File.delete(@new_resource.target_file) - Chef::Log.info("#{@new_resource} deleted") + if Chef::Platform.windows? && ::File.directory?(@current_resource.target_file) + converge_by("delete link to dir at #{@new_resource.target_file}") do + ::Dir.delete(@new_resource.target_file) + Chef::Log.info("#{@new_resource} deleted") + end + else + converge_by("delete link to file at #{@new_resource.target_file}") do + ::File.delete(@new_resource.target_file) + Chef::Log.info("#{@new_resource} deleted") + end end end end |