https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112020-06-20T05:15:54ZRuby Issue Tracking SystemRuby master - Feature #16972: Pathname#mkpath to accept block to call on each created directoryhttps://bugs.ruby-lang.org/issues/16972?journal_id=862722020-06-20T05:15:54Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/86272/diff?detail_id=57383">diff</a>)</li><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>akr (Akira Tanaka)</i></li></ul><p><code>Pathname#mkpath</code> is a wrapper of <code>FileUtils.mkdir_p</code>, and the latter has <code>mode:</code> argument to create intermediate directories.<br>
So it would be simple and better to add the same option to <code>Pathname#mkpath</code> for this purpose, I think.<br>
Or do you have any other use cases that this more generic solution is needed?</p>
<p><a href="https://github.com/ruby/ruby/pull/3243" class="external">https://github.com/ruby/ruby/pull/3243</a></p> Ruby master - Feature #16972: Pathname#mkpath to accept block to call on each created directoryhttps://bugs.ruby-lang.org/issues/16972?journal_id=862912020-06-22T14:55:50ZDan0042 (Daniel DeLorme)
<ul></ul><p>Thanks for the tip; all these years and I never realized <code>FileUtils.mkdir_p</code> had this <code>mode:</code> argument (and/or never realized what it was for).<br>
I can <em>imagine</em> use cases for this generic solution: chown, chgrp, touch index.html<br>
And in general I think it's better design to have generic/basic building blocks that can be combined in flexible ways.<br>
But I have not personally experienced a need other than chmod, so for my case <code>FileUtils.mkdir_p</code> is enough.</p> Ruby master - Feature #16972: Pathname#mkpath to accept block to call on each created directoryhttps://bugs.ruby-lang.org/issues/16972?journal_id=935042021-08-31T02:54:06Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="[Feature #16972] Add mode: option to Pathname#mkpath" href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/2dd26bed86f721ed1982d00c3a0bd5ed37568e96">git|2dd26bed86f721ed1982d00c3a0bd5ed37568e96</a>.</p>
<hr>
<p>[Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Pathname#mkpath to accept block to call on each created directory (Closed)" href="https://bugs.ruby-lang.org/issues/16972">#16972</a>] Add mode: option to Pathname#mkpath</p>