Class: FileUtils::Entry_

Inherits:
Object
  • Object
show all
Defined in:
lib/berkshelf/core_ext/fileutils.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/berkshelf/core_ext/fileutils.rb', line 64

def link(dest)
  case
  when directory?
    if !File.exist?(dest) and descendant_diretory?(dest, path)
      raise ArgumentError, "cannot link directory %s to itself %s" % [path, dest]
    end
    begin
      Dir.mkdir dest
    rescue
      raise unless File.directory?(dest)
    end
  else
    File.link path(), dest
  end
end