Module: FileUtils

Defined in:
lib/berkshelf/core_ext/file_utils.rb

Class Method Summary collapse

Class Method Details

.mv(src, dest, options = {}) ⇒ Object

If we encounter Errno::EACCES, which seems to happen occasionally on Windows, try to copy and delete the file instead of moving it.

It’s also possible that we get Errno::ENOENT if we try to ‘mv` a relative symlink on Linux



16
17
18
19
20
21
22
# File 'lib/berkshelf/core_ext/file_utils.rb', line 16

def mv(src, dest, options = {})
  old_mv(src, dest, **options)
rescue Errno::EACCES, Errno::ENOENT
  options.delete(:force) if options.key?(:force)
  FileUtils.cp_r(src, dest, **options)
  FileUtils.rm_rf(src)
end

.old_mvObject



5
# File 'lib/berkshelf/core_ext/file_utils.rb', line 5

alias_method :old_mv, :mv