Issue #6811 has been updated by trans (Thomas Sawyer).


Sorry, it is if $DEBUG = true, not $VERBOSE.

Here's the issue:

> FileUtils.mkdir_p('a/b/c/d')
Exception `Errno::ENOENT' at /home/trans/.local/lib/ry/rubies/1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:247 - No such file or directory - a/b/c/d
Exception `Errno::EEXIST' at /home/trans/.local/lib/ry/rubies/1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:247 - File exists - .
=> ["a/b/c/d"]

It the most annoying warning, and I always end-up writing my own method instead.

----------------------------------------
Feature #6811: File, Dir and FileUtils should have bang-versions of singleton methods that fails silently
https://bugs.ruby-lang.org/issues/6811#change-28540

Author: prijutme4ty (Ilya Vorontsov)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


I found that often write 
Dir.mkdir(folder) unless Dir.exist? folder
and similar code for rm, rm_rf and so on
We can simply make bang-versions like
def Dir.mkdir!(folder, permissions=0744)
  Dir.mkdir(folder, permissions) unless Dir.exist? folder
# or another alternative  Dir.mkdir(folder, permissions) rescue false
end


-- 
http://bugs.ruby-lang.org/