Method: Pathname#copy

Defined in:
lib/xccache/core/system.rb

#copy(to: nil, to_dir: nil) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/xccache/core/system.rb', line 45

def copy(to: nil, to_dir: nil)
  dst = to || (Pathname(to_dir) / basename)
  dst.rmtree if dst.exist? || dst.symlink?
  dst.parent.mkpath
  FileUtils.copy_entry(self, dst)
  dst
end