FileUtils.mv and the :force option

  • Thread starter Joel VanderWerf
  • Start date
J

Joel VanderWerf

The :force option is mentioned in the docs, but it is rejected by
FileUtils.mv. It's easy enough to use a 'rescue Errno' suffix to get
this behavior, so I'm not proposing it should be implemented as an
option to the method. Maybe just remove it from the documentation, then?

----------------------------------------------------------- FileUtils#mv
mv(src, dest, options = {})
------------------------------------------------------------------------
Options: noop verbose

Moves file(s) +src+ to +dest+. If +file+ and +dest+ exist on the
different disk partition, the file is copied instead.

FileUtils.mv 'badname.rb', 'goodname.rb'
FileUtils.mv 'stuff.rb', 'lib/ruby', :force => true
 
J

Joel VanderWerf

Joel said:
The :force option is mentioned in the docs, but it is rejected by
FileUtils.mv. It's easy enough to use a 'rescue Errno' suffix to get
this behavior, so I'm not proposing it should be implemented as an
option to the method. Maybe just remove it from the documentation, then?

Oops, 'FileUtils.mv ... rescue Errno' is not what the force option would
do. So why isn't :force implemented?
 
M

Minero Aoki

Hi,

In mail "Re: FileUtils.mv and the :force option"
Joel VanderWerf said:
Oops, 'FileUtils.mv ... rescue Errno' is not what the force option would
do. So why isn't :force implemented?

Because it is a bug.
I have implemented `force' option now, thanks.

FYI: `Errno' should be SystemCallError.

Best Regards,
Minero Aoki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top