aboutsummaryrefslogtreecommitdiff
path: root/docs/spec
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-07 07:39:47 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-07 07:39:47 -0400
commit83839ce9eb4b0a2d38e6b950a8b63552e089d371 (patch)
tree48b6a04a56e3f3fde032240f7ab3155590e2a9ed /docs/spec
parentd774e7b23ea6b03e5999bc6ebdf3245efac8dd83 (diff)
Add CreateDir and List for directory manipulation
Diffstat (limited to 'docs/spec')
-rw-r--r--docs/spec/system.html13
1 files changed, 11 insertions, 2 deletions
diff --git a/docs/spec/system.html b/docs/spec/system.html
index d8a1e26d..5181867e 100644
--- a/docs/spec/system.html
+++ b/docs/spec/system.html
@@ -155,7 +155,7 @@
</table>
<p>Times are Unix timestamps, that is, seconds since the Unix epoch, as used by <a href="#time">time</a> system values.</p>
<h3 id="file-access">File access</h3>
-<p>File access functions read or write files, either by manipulating files as a whole or interacting with the contents. Whole-file functions cannot overwrite target files: that is, <code><span class='Function'>Rename</span></code> and <code><span class='Function'>Copy</span></code> must give an error if a file exists at <code><span class='Value'>𝕨</span></code>, while <code><span class='Function'>Chars</span></code>, <code><span class='Function'>Lines</span></code>, and <code><span class='Function'>Bytes</span></code> can overwrite the contents of an existing file <code><span class='Value'>𝕨</span></code>. However, these three functions must give an error if <code><span class='Value'>𝕨</span></code> exists and is a directory.</p>
+<p>File access functions read or write files, either by manipulating files as a whole or interacting with the contents. Whole-file functions cannot overwrite target files: that is, <code><span class='Function'>Rename</span></code> and <code><span class='Function'>Copy</span></code> must give an error if a file exists at <code><span class='Value'>𝕨</span></code>, and <code><span class='Function'>CreateDir</span></code> if a file exists at <code><span class='Value'>𝕩</span></code>, while <code><span class='Function'>Chars</span></code>, <code><span class='Function'>Lines</span></code>, and <code><span class='Function'>Bytes</span></code> can overwrite the contents of an existing file <code><span class='Value'>𝕨</span></code>. However, these three functions must give an error if <code><span class='Value'>𝕨</span></code> exists and is a directory.</p>
<table>
<thead>
<tr>
@@ -177,6 +177,10 @@
<td>Copy file <code><span class='Value'>𝕩</span></code> to path <code><span class='Value'>𝕨</span></code></td>
</tr>
<tr>
+<td><code><span class='Function'>CreateDir</span></code></td>
+<td>Create a directory at path <code><span class='Value'>𝕩</span></code></td>
+</tr>
+<tr>
<td><code><span class='Function'>Remove</span></code></td>
<td>Delete file <code><span class='Value'>𝕩</span></code></td>
</tr>
@@ -185,6 +189,10 @@
<td>Recursively delete directory <code><span class='Value'>𝕩</span></code> and all contents</td>
</tr>
<tr>
+<td><code><span class='Function'>List</span></code></td>
+<td>Return names of all files in directory <code><span class='Value'>𝕩</span></code></td>
+</tr>
+<tr>
<td><code><span class='Function'>Chars</span></code></td>
<td>Read from or write to entire file, as characters</td>
</tr>
@@ -198,7 +206,8 @@
</tr>
</tbody>
</table>
-<p><code><span class='Function'>Rename</span></code> and <code><span class='Function'>Copy</span></code> return the path of the new file. <code><span class='Function'>Remove</span></code> and <code><span class='Function'>RemoveDir</span></code> return <code><span class='Number'>1</span></code> to indicate successful removal (and error otherwise).</p>
+<p><code><span class='Function'>Rename</span></code>, <code><span class='Function'>Copy</span></code>, and <code><span class='Function'>CreateDir</span></code> return the path of the new file. <code><span class='Function'>Remove</span></code> and <code><span class='Function'>RemoveDir</span></code> return <code><span class='Number'>1</span></code> to indicate successful removal (and error otherwise).</p>
+<p><code><span class='Function'>List</span></code> returns filenames only, without extensions. It lists all files and directories including hidden ones, but not the current and parent directory names <code><span class='Value'>.</span></code> and <code><span class='Value'>..</span></code>.</p>
<p>Functions <code><span class='Function'>Chars</span></code>, <code><span class='Function'>Lines</span></code>, and <code><span class='Function'>Bytes</span></code> are all ambivalent. If only <code><span class='Value'>𝕩</span></code> is given, then it is a filename, and the result is the contents of the file in the appropriate format. If there are two arguments, then <code><span class='Value'>𝕨</span></code> is the filename and <code><span class='Value'>𝕩</span></code> is the desired contents. These are written to the file, overwriting its contents, and the absolute filename <code><span class='Value'>𝕨</span></code> is returned. The three formats are:</p>
<ul>
<li>Chars: BQN characters, or UTF-32. The file is assumed to be UTF-8 encoded.</li>