Make directory path: Difference between revisions
Content added Content deleted
(Add Factor example) |
|||
Line 268: | Line 268: | ||
Root = C:\;} |
Root = C:\;} |
||
> </pre> |
> </pre> |
||
=={{header|Factor}}== |
|||
The <code>make-directories</code> word performs this task. Note the value of <code>current-directory</code> is used as the base directory if a relative pathname is given. |
|||
<lang factor>USE: io.directories |
|||
"path/to/dir" make-directories</lang> |
|||
The implementation of <code>make-directories</code>: |
|||
<lang factor>USING: combinators.short-circuit io.backend io.files |
|||
io.pathnames kernel sequences ; |
|||
IN: io.directories |
|||
: make-directories ( path -- ) |
|||
normalize-path trim-tail-separators dup |
|||
{ [ "." = ] [ root-directory? ] [ empty? ] [ exists? ] } 1|| |
|||
[ make-parent-directories dup make-directory ] unless drop ;</lang> |
|||
=={{header|Gambas}}== |
=={{header|Gambas}}== |