All Manuals > LispWorks® User Guide and Reference Manual > 27 LispWorks' Operating Environment

27.14 File system interface

27.14.1 Encoding of file names and strings in OS interface functions

On non-Windows platforms, LispWorks tries to determine the appropriate external format to use for encoding file names, as well as other strings that are passed to the OS. This is done on startup using the standard POSIX environment variables LC_ALL, LC_CTYPE and LANG (in that order). If the first of these that is set specifies a "codeset" (which means it contains a dot and the "codeset" is the bit after the dot) that matches a LispWorks external format, then LispWorks uses this external format. Otherwise, LispWorks uses :utf-8, which is what was used before LispWorks 8.0.

The same external format is also used use to encode the values in environment-variable, as well as the command line arguments and environment variables in the functions call-system, call-system-showing-output, open-pipe and run-shell-command. It is also used to decode the command line arguments passed to LispWorks and stored in *line-arguments-list*.

27.14.2 Fast access to files in a directory

fast-directory-files gives a faster way to access files than directory, especially in situations when you need to filter based on simple features such as size and access time, or filter based on the name in a more complex way than directory can.

Instead of creating a list of pathnames and returning it, fast-directory-files traverses the files and calls a callback function on each file with its name and an opaque handle, which is referred to as fdf-handle. From this handle, you can retrieve the size, last-access time and last-modify time, and query whether the file is a directory, whether it is a link (for platforms other than Windows), and whether it is writable. The implementation makes the access to the fdf-handle much faster than doing the same by calling directory and then calling cl:file-write-date and similar functions on the result.

When the callback returns non-nil, fast-directory-files collects the filename, otherwise it ignores it. Hence the callback can be used both as a filter and to actually do some work. In many cases, the callback will always return nil, and the call will be used just to map the callback on the file for the "side-effects" of the callback.

fast-directory-files is restricted to one directory level, that is it cannot deal with wild directories.

LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:24