Make directory path: Difference between revisions
Rename Perl 6 -> Raku, alphabetize, minor clean-up
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
|||
Line 160:
return 0;
}</lang>
=={{header|C sharp|C#}}==▼
<lang csharp>System.IO.Directory.CreateDirectory(path)</lang>▼
=={{header|C++|CPP}}==
Line 189 ⟶ 192:
}
}
</lang>▼
▲=={{header|C sharp|C#}}==
▲<lang csharp>System.IO.Directory.CreateDirectory(path)</lang>
=={{header|Common Lisp}}==▼
<lang lisp>▼
(ensure-directories-exist "your/path/name")▼
</lang>
Line 205 ⟶ 200:
true
(.mkdirs dir))))</lang>
▲=={{header|Common Lisp}}==
▲<lang lisp>
▲(ensure-directories-exist "your/path/name")
▲</lang>
=={{header|D}}==
Line 458:
make_path('path/to/dir')</lang>
=={{header|Perl 6}}==▼
{{Works with|rakudo|2016.06}}▼
There is a built-in function for this:▼
<lang perl6>mkdir 'path/to/dir'</lang>▼
Alternatively, a custom solution (as per task description) that only uses the built-in <tt>mkdir</tt> non-recursively. The "triangle reduce" meta-operator <code>[\ ]</code> is used get the intermediate results of a left fold with the comma operator on the list of path elements.▼
<lang perl6>for [\,] $*SPEC.splitdir("../path/to/dir") -> @path {▼
mkdir $_ unless .e given $*SPEC.catdir(@path).IO;▼
}</lang>▼
=={{header|Phix}}==
Line 612 ⟶ 599:
</pre>
(formerly Perl 6)
▲{{Works with|rakudo|2016.06}}
▲There is a built-in function for this:
▲<lang perl6>mkdir 'path/to/dir'</lang>
▲Alternatively, a custom solution (as per task description) that only uses the built-in <tt>mkdir</tt> non-recursively. The "triangle reduce" meta-operator <code>[\ ]</code> is used get the intermediate results of a left fold with the comma operator on the list of path elements.
▲<lang perl6>for [\,] $*SPEC.splitdir("../path/to/dir") -> @path {
▲ mkdir $_ unless .e given $*SPEC.catdir(@path).IO;
▲}</lang>
=={{header|REXX}}==
|