class File

MiGA extensions to the File class.

Public Class Methods

generic_transfer(old_name, new_name, method) click to toggle source

Method to transfer a file from old_name to new_name, using a method that can be one of :symlink for File#symlink, :hardlink for File#link, or :copy for FileUtils#cp_r.

# File lib/miga/common/path.rb, line 25
def self.generic_transfer(old_name, new_name, method)
  return nil if exist? new_name

  if (method == :copy)
    FileUtils.cp_r(old_name, new_name)
    method = :link if method == :hardlink
    File.send(method, old_name, new_name)