Module: FileUtils
- Defined in:
- lib/vendor/puppet/util/monkey_patches.rb
Class Method Summary collapse
Class Method Details
.move ⇒ Object
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/vendor/puppet/util/monkey_patches.rb', line 246 def mv(src, dest, = {}) , OPT_TABLE['mv'] "mv#{[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if [:verbose] return if [:noop] fu_each_src_dest(src, dest) do |s, d| destent = Entry_.new(d, nil, true) begin if destent.exist? if destent.directory? raise Errno::EEXIST, dest else destent.remove_file if rename_cannot_overwrite_file? end end begin File.rename s, d rescue Errno::EXDEV copy_entry s, d, true if [:secure] remove_entry_secure s, [:force] else remove_entry s, [:force] end end rescue SystemCallError raise unless [:force] end end end |
.mv(src, dest, options = {}) ⇒ Object
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/vendor/puppet/util/monkey_patches.rb', line 215 def mv(src, dest, = {}) , OPT_TABLE['mv'] "mv#{[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if [:verbose] return if [:noop] fu_each_src_dest(src, dest) do |s, d| destent = Entry_.new(d, nil, true) begin if destent.exist? if destent.directory? raise Errno::EEXIST, dest else destent.remove_file if rename_cannot_overwrite_file? end end begin File.rename s, d rescue Errno::EXDEV copy_entry s, d, true if [:secure] remove_entry_secure s, [:force] else remove_entry s, [:force] end end rescue SystemCallError raise unless [:force] end end end |