|
|
Line 160: |
Line 160: |
|
return 0; |
|
return 0; |
|
}</lang> |
|
}</lang> |
|
|
|
|
⚫ |
=={{header|C sharp|C#}}== |
|
⚫ |
<lang csharp>System.IO.Directory.CreateDirectory(path)</lang> |
|
|
|
|
|
=={{header|C++|CPP}}== |
|
=={{header|C++|CPP}}== |
Line 189: |
Line 192: |
|
} |
|
} |
|
} |
|
} |
⚫ |
|
|
|
|
|
⚫ |
=={{header|C sharp|C#}}== |
|
⚫ |
<lang csharp>System.IO.Directory.CreateDirectory(path)</lang> |
|
|
|
|
⚫ |
=={{header|Common Lisp}}== |
|
⚫ |
|
|
⚫ |
(ensure-directories-exist "your/path/name") |
|
|
</lang> |
|
</lang> |
|
|
|
|
Line 205: |
Line 200: |
|
true |
|
true |
|
(.mkdirs dir))))</lang> |
|
(.mkdirs dir))))</lang> |
|
|
|
|
⚫ |
=={{header|Common Lisp}}== |
|
⚫ |
|
|
⚫ |
(ensure-directories-exist "your/path/name") |
|
⚫ |
|
|
|
|
|
|
=={{header|D}}== |
|
=={{header|D}}== |
Line 458: |
Line 458: |
|
|
|
|
|
make_path('path/to/dir')</lang> |
|
make_path('path/to/dir')</lang> |
|
|
|
⚫ |
|
|
⚫ |
{{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; |
|
⚫ |
|
|
|
|
|
|
|
=={{header|Phix}}== |
|
=={{header|Phix}}== |
Line 612: |
Line 599: |
|
|
|
|
|
</pre> |
|
</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; |
|
⚫ |
|
|
|
|
|
|
=={{header|REXX}}== |
|
=={{header|REXX}}== |