Sha256: 0efe1d01ee16fd913887ab795730c81a7c8753d3c9da1c0356c88267eb19481a
Contents?: true
Size: 735 Bytes
Versions: 23
Compression:
Stored size: 735 Bytes
Contents
require "fileutils" module FileUtils class << self alias_method :old_mv, :mv # If we encounter Errno::EACCES, which seems to happen occasionally on Windows, # try to copy and delete the file instead of moving it. # # @see https://github.com/berkshelf/berkshelf/issues/140 # @see http://www.ruby-forum.com/topic/1044813 # # It's also possible that we get Errno::ENOENT if we try to `mv` a relative # symlink on Linux # @see {FileUtils::mv} def mv(src, dest, options = {}) old_mv(src, dest, options) rescue Errno::EACCES, Errno::ENOENT options.delete(:force) if options.has_key?(:force) FileUtils.cp_r(src, dest, options) FileUtils.rm_rf(src) end end end
Version data entries
23 entries across 23 versions & 1 rubygems