From: "Eregon (Benoit Daloze)" Date: 2012-07-30T00:26:32+09:00 Subject: [ruby-core:46862] [ruby-trunk - Feature #6811] File, Dir and FileUtils should have bang-versions of singleton methods that fails silently Issue #6811 has been updated by Eregon (Benoit Daloze). prijutme4ty (Ilya Vorontsov) wrote: > I found that often write > Dir.mkdir(folder) unless Dir.exist? folder > and similar code for rm, rm_rf and so on Bang methods are not usually used for that in Ruby core and stdlib. I agree for the practical point of view of this though. I'm unsure what a good name would be. Using mkdir_p for this seems a bit dangerous, as it might create intermediary directories you did not intend to. trans wrote: > although it annoyingly warns about missing path if $VERBOSE=true (can we consider that a bug please?). How so? ---------------------------------------- Feature #6811: File, Dir and FileUtils should have bang-versions of singleton methods that fails silently https://bugs.ruby-lang.org/issues/6811#change-28537 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/