Abstract
CL-FAD (for "Files and Directories") is a thin layer atop Common Lisp's standard pathname functions. It is intended to provide some unification between current CL implementations on Windows, OS X, Linux, and Unix. Most of the code was written by Peter Seibel for his book Practical Common Lisp.CL-FAD comes with a BSD-style license so you can basically do with it whatever you want.
Download shortcut: http://weitz.de/files/cl-fad.tar.gz.
CL-FAD comes with simple system definitions for MK:DEFSYSTEM and asdf so you can either adapt it
to your needs or just unpack the archive and from within the CL-FAD
directory start your Lisp image and evaluate the form
(mk:compile-system "cl-fad") - or (asdf:oos 'asdf:load-op :cl-fad) for asdf - which should compile and load the whole
system.
Installation via asdf-install should as well
be possible. Plus, there are ports
for Gentoo Linux thanks to Matthew Kennedy
and for Debian Linux thanks to René van Bevern.
If for some reason you can't or don't want to use MK:DEFSYSTEM or asdf you
can just LOAD the file load.lisp.
The following Common Lisp implementations are currently supported:
[Function]
directory-pathname-p pathspec => generalized-boolean
ReturnsNILifpathspec(a pathname designator) does not designate a directory,pathspecotherwise. It is irrelevant whether the file or directory designated bypathspecdoes actually exist.
[Function]
pathname-as-directory pathspec => pathname
Converts the non-wild pathname designatorpathspecto directory form, i.e. it returns a pathname which would return a true value if fed toDIRECTORY-PATHNAME-P.
[Function]
pathname-as-file pathspec => pathname
Converts the non-wild pathname designatorpathspecto file form, i.e. it returns a pathname which would return aNILvalue if fed toDIRECTORY-PATHNAME-P.
[Function]
file-exists-p pathspec => generalized-boolean
Checks whether the file named by the pathname designatorpathspecexists and returns its truename if this is the case,NILotherwise. The truename is returned in "canonical" form, i.e. the truename of a directory is returned in directory form as if byPATHNAME-AS-DIRECTORY.
[Function]
directory-exists-p pathspec => generalized-boolean
Checks whether the file named by the pathname designatorpathspecexists and if it is a directory. Returns its truename if this is the case,NILotherwise. The truename is returned in directory form as if byPATHNAME-AS-DIRECTORY.
[Function]
list-directory dirname => list
Returns a fresh list of pathnames corresponding to the truenames of all files within the directory named by the non-wild pathname designatordirname. The pathnames of sub-directories are returned in directory form - seePATHNAME-AS-DIRECTORY.
[Function]
walk-directory dirname fn &key directories if-does-not-exist test => |
Recursively applies the function designated by the function designatorfnto all files within the directory named by the non-wild pathname designatordirnameand all of its sub-directories.fnwill only be applied to files for which the functiontestreturns a true value. (The default value fortestalways returns true.) Ifdirectoriesis notNIL,fnandtestare applied to directories as well. Ifdirectoriesis:DEPTH-FIRST,fnwill be applied to the directory's contents first. Ifdirectoriesis:BREADTH-FIRSTandtestreturnsNIL, the directory's content will be skipped.if-does-not-existmust be one of:ERRORor:IGNOREwhere:ERROR(the default) means that an error will be signaled if the directorydirnamedoes not exist.
[Function]
delete-directory-and-files dirname&key if-does-not-exist => |
Recursively deletes all files and directories within the directory designated by the non-wild pathname designatordirnameincludingdirnameitself.if-does-not-existmust be one of:ERRORor:IGNOREwhere:ERROR(the default) means that an error will be signaled if the directorydirnamedoes not exist.
[Function]
copy-file from to &key overwrite => |
Copies the file designated by the non-wild pathname designatorfromto the file designated by the non-wild pathname designatorto. Ifoverwriteis true (the default isNIL) overwrites the file designtated bytoif it exists.
[Function]
copy-stream from to &optional checkp => |
Copies intoto(a stream) fromfrom(also a stream) until the end offromis reached. The streams should have the same element type unless they are bivalent. Ifcheckpis true (which is the default), the function will signal an error if the element types aren't the same.
$Header: /usr/local/cvsrep/cl-fad/doc/index.html,v 1.24 2006/08/11 14:07:30 edi Exp $