This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Source for wiki DirectoryPortsCowan version 6

author

cowan

comment


    

ipnr

98.14.172.204

name

DirectoryPortsCowan

readonly

0

text

== Directory ports ==

This module depends on the acceptance of PortsCowan or something like it, as it uses the framework of that proposal.  See DirectoriesCowan for a proposal for creating and destroying directories.

== Procedures ==

`(open-directory `''filename''`)`

''Filename'' can be a string or a ''settings list'' as described in PortsCowan.  In addition to the keys `path` and `encoding` specified there, the key `hidden` can have the values `none` (don't expose hidden files), `all` (expose all files), and `dots` (expose all files except `.` and `..`).  On Posix systems, hidden files have names beginning with `.`; on Windows, hidden files are named `.`, `..`, or have the `hidden` file attribute.

The returned value is an input port, but it is neither a binary port nor a character port, so the only standard procedure callable on it is `read`, which returns the next available filename as a string (or, when necessary, an implementation-dependent object).  Filenames are returned in arbitrary order.

`(call-with-input-directory `''filename''` `''proc''`)` 

''Filename'' MUST be an object acceptable to `open-directory`, and ''proc'' MUST be a procedure that accepts one argument. Calls ''proc'' with one argument, the port obtained by opening the specified directory.  If the directory cannot be opened, an error is signalled. If ''proc'' returns, then the port is closed automatically and the value(s) yielded by the ''proc'' is (are) returned.  If ''proc'' does not return, then the port will not be closed automatically unless it is possible to prove that the port will never again be used for a read operation.

`(directory-port? `''obj''`)`

Returns `#t` if ''obj'' is a directory port.  Directory ports are a disjoint type.

time

2010-12-15 01:33:17

version

6