copy(dest)public
No documentation available.
# File lib/fileutils.rb, line 1255
def copy(dest)
lstat
case
when file?
copy_file dest
when directory?
if !File.exist?(dest) and descendant_directory?(dest, path)
raise ArgumentError, "cannot copy directory %s to itself %s" % [path, dest]
end
begin
Dir.mkdir dest
rescue
raise unless File.directory?(dest)
end
when symlink?
File.symlink File.readlink(path()), dest
when chardev?
raise "cannot handle device file" unless File.respond_to?(:mknod)
mknod dest, cc, 0666, lstat().rdev
when blockdev?
raise "cannot handle device file" unless File.respond_to?(:mknod)
mknod dest, bb, 0666, lstat().rdev
when socket?
raise "cannot handle socket" unless File.respond_to?(:mknod)
mknod dest, nil, lstat().mode, 0
when pipe?
raise "cannot handle FIFO" unless File.respond_to?(:mkfifo)
mkfifo dest, 0666
when door?
raise "cannot handle door: #{path()}"
else
raise "unknown file type: #{path()}"
end
end