diff -pruN 0.7.4-1/CHANGELOG 20180430-1/CHANGELOG --- 0.7.4-1/CHANGELOG 2016-07-10 19:12:08.000000000 +0000 +++ 20180430-1/CHANGELOG 2018-04-14 13:32:16.000000000 +0000 @@ -1,3 +1,8 @@ +Version 0.7.5 +2017-12-10 +Fix FILE-EXISTS-P to return directory truename in CLISP (chaitanyagupta) +Added support for Common Lisp implementation CLASP. (dg1sbg) + Version 0.7.4 2016-07-10 Merge pull request #13 from vibs29/master (Hans Hübner) diff -pruN 0.7.4-1/cl-fad.asd 20180430-1/cl-fad.asd --- 0.7.4-1/cl-fad.asd 2016-07-10 19:12:08.000000000 +0000 +++ 20180430-1/cl-fad.asd 2018-04-14 13:32:16.000000000 +0000 @@ -30,9 +30,10 @@ #+:allegro (cl:require :osi) (asdf:defsystem #:cl-fad - :version "0.7.4" + :version "0.7.5" :description "Portable pathname library" :serial t + :license "BSD-2-Clause" :components ((:file "packages") #+:cormanlisp (:file "corman") #+:openmcl (:file "openmcl") diff -pruN 0.7.4-1/debian/changelog 20180430-1/debian/changelog --- 0.7.4-1/debian/changelog 2016-08-29 18:55:20.000000000 +0000 +++ 20180430-1/debian/changelog 2018-05-16 09:47:26.000000000 +0000 @@ -1,3 +1,9 @@ +cl-fad (20180430-1) unstable; urgency=medium + + * Quicklisp release update. + + -- Dimitri Fontaine Wed, 16 May 2018 09:47:26 +0000 + cl-fad (0.7.4-1) unstable; urgency=medium * Quicklisp release update. diff -pruN 0.7.4-1/debian/compat 20180430-1/debian/compat --- 0.7.4-1/debian/compat 2014-04-30 14:01:04.000000000 +0000 +++ 20180430-1/debian/compat 2018-03-06 13:38:56.000000000 +0000 @@ -1 +1 @@ -7 \ No newline at end of file +9 \ No newline at end of file diff -pruN 0.7.4-1/debian/control 20180430-1/debian/control --- 0.7.4-1/debian/control 2014-08-04 15:25:23.000000000 +0000 +++ 20180430-1/debian/control 2018-03-06 13:38:56.000000000 +0000 @@ -4,7 +4,7 @@ Priority: optional Maintainer: Dimitri Fontaine Build-Depends: debhelper (>= 7) Build-Depends-Indep: dh-lisp -Standards-Version: 3.9.5 +Standards-Version: 4.1.3 Homepage: http://weitz.de/cl-fad/ Vcs-Git: https://github.com/edicl/cl-fad.git Vcs-Browser: https://github.com/edicl/cl-fad diff -pruN 0.7.4-1/debian/rules 20180430-1/debian/rules --- 0.7.4-1/debian/rules 2014-07-23 12:35:09.000000000 +0000 +++ 20180430-1/debian/rules 2018-03-06 13:38:56.000000000 +0000 @@ -16,4 +16,4 @@ override_dh_link: dh_link $(clc-files)/$(pkg).asd $(clc-systems)/$(pkg).asd override_dh_installdocs: - dh_installdocs doc/index.html + dh_installdocs docs/index.html diff -pruN 0.7.4-1/doc/index.html 20180430-1/doc/index.html --- 0.7.4-1/doc/index.html 2016-07-10 19:12:08.000000000 +0000 +++ 20180430-1/doc/index.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,700 +0,0 @@ - - - - - - CL-FAD - A portable pathname library for Common Lisp - - - - - -

CL-FAD - A portable pathname library for Common Lisp

- -
-
 

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. -

- -
 

Contents

-
    -
  1. Download and installation -
  2. Supported Lisp implementations -
  3. The CL-FAD dictionary -
      -
    1. Querying files, directories and pathnames -
        -
      1. directory-exists-p [function] -
      2. directory-pathname-p [function] -
      3. file-exists-p [function] -
      4. pathname-absolute-p [function] -
      5. pathname-equal [function] -
      6. pathname-relative-p [function] -
      7. pathname-root-p [function] -
    2. -
    3. Manipulating pathnames -
        -
      1. canonical-pathname [function] -
      2. merge-pathnames-as-directory [function] -
      3. merge-pathnames-as-file [function] -
      4. pathname-as-directory [function] -
      5. pathname-as-file [function] -
      6. pathname-directory-pathname [function] -
      7. pathname-parent-directory [function] -
    4. -
    5. Traversing directories -
        -
      1. list-directory [function] -
      2. walk-directory [function] -
    6. -
    7. Temporary Files -
        -
      1. open-temporary [function] -
      2. with-output-to-temporary-file [macro] -
      3. with-open-temporary-file [macro] -
      4. *default-template* [variable] -
      5. cannot-create-temporary-file [condition] -
      6. invalid-temporary-pathname-template [condition] -
      7. missing-temp-environment-variable [condition] -
      8. temporary-files [logical pathname host] -
      -
    8. -
    9. Modifying the file system -
        -
      1. copy-file [function] -
      2. copy-stream [function] -
      3. delete-directory-and-files [function] -
    10. -
    11. path [package] -
    -
  4. Acknowledgements -
- - - -
 

Download and installation

- -CL-FAD together with this documentation can be downloaded from http://weitz.de/files/cl-fad.tar.gz. The -current version is 0.7.2. -

-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 latest version of the source code lives in the github repository edicl/cl-fad. - -If you want to send patches, -please read this first. -Please submit your changes -as GitHub pull -request". - -
 

Supported Lisp implementations

- -

-The following Common Lisp implementations are currently supported: -

- -I'll gladly accepts patches to make CL-FAD work on other platforms. - - -
 

The CL-FAD dictionary

- -

Querying files, directories and pathnames

- -


[Function] -
directory-exists-p pathspec => generalized-boolean - -


-Checks whether the file named by the pathname designator pathspec -exists and if it is a directory. Returns its truename if this is the -case, NIL otherwise. The truename is returned in directory form as if -by PATHNAME-AS-DIRECTORY. -
- -


[Function] -
directory-pathname-p pathspec => generalized-boolean - -


-Returns NIL if pathspec (a pathname designator) does not designate -a directory, pathspec otherwise. It is irrelevant whether the file or -directory designated by pathspec does actually exist. -
- -


[Function] -
file-exists-p pathspec => generalized-boolean - -


-Checks whether the file named by the pathname designator pathspec -exists and returns its truename if this is the case, NIL otherwise. -The truename is returned in "canonical" form, i.e. the truename of a -directory is returned in directory form as if by PATHNAME-AS-DIRECTORY. -
- -


[Function]
pathname-absolute-p a => result -

-

Returns true if a is an absolute pathname. This simply -tests if a's directory list starts with :ABSOLUTE

-
- -


[Function]
pathname-equal a b => result -

- -

Returns true if a and b -represent the same pathname. This function does not access the -filesystem, it only looks at the components of the two pathnames to -test if they are the same (though by passing both a -and b to probe-file one can make this function test for -file 'sameness'.

- -

Equality is defined as:

- -
    -
  • strings that are string= -
  • symbols (including nil and keywords) which are eql -
  • lists of the same length with equal (as per these rules) elements. -
- -

If any of these tree conditions is false for any of the components in -a and b then a -and b are different, otherwise they are the same.

- -

NB: This function does not convert name strings to pathnames. So -"foo.txt" and #P"foo.txt" are different pathnames.

- -
- -


[Function]
pathname-relative-p a => result -

-

Returns true if a is a relative pathname. This simply -tests if a's directory starts -with :RELATIVE.

-
- -


[Function]
pathname-root-p a => result -

-

Returns true if pathname is the root -directory (in other words, a directory which is its own parent).

-
- -

Manipulating pathnames

- -


[Function]
canonical-pathname pathname => result -

-

Remove reduntant information from PATHNAME.

- -

This simply walks down PATHNAME's -pathname-directory and drops "." directories, removes :back -and its preceding element.

- -

NB: This function does not access the filesystem, it only looks at the -values in the pathname and works on their known (or assumed) -meanings.

- -

NB: Since this function does not access the filesystem it will only -remove :BACK elements from the path (not :UP -elements). Since some lisps, ccl/sbcl/clisp convert ".." in -pathnames to :UP, and not :BACK, the actual -utility of the function is limited.

-
- -


[Function]
merge-pathnames-as-directory &rest pathnames => result -

-

Given a list of, probably relative, pathnames returns a single -directory pathname containing the logical concatenation of them all.

- -

The returned value is the current directory if one were to cd into -each of pathnames in order. For this reason an -absolute pathname will, effectively, cancel the affect of any previous -relative pathnames.

- -

The returned value's defaults are taken from the first element of -pathnames (host, version and device).

- -

NB: Since this function only looks at directory names the name and -type of the elements of pathnames are ignored. Make sure to properly -use either trailing #\/s, or pathname-as-directory, to get the -expected results.

- -

Examples:

- -
-  (merge-pathnames-as-directory #P"foo/" #P"bar/") == #P"foo/bar/"
-
-  (merge-pathnames-as-directory #P"foo/" #P"./bar/") == #P"foo/./bar/"
-
-  (merge-pathnames-as-directory #P"foo/" #P"/bar/") == #P"/bar/"
-
-  (merge-pathnames-as-directory #P"foo/" #P"/bar/" #P'quux/file.txt) == #P"/bar/quux/"
-
- -
- -


[Function]
merge-pathnames-as-file &rest pathnames => result -

-

Given a list of, probably relative, pathnames returns a single -filename pathname containing the logical concatenation of them all.

- -

The returned value's defaults are taken from the first element of -pathnames (host, version and device). The returned -values's name, type and version are taken from the last element -of pathnames. The intervening elements are used only for -their pathname-directory values.

- -Examples: - -
-  (merge-pathnames-as-file #P"foo/" #P"bar.txt") == #P"foo/bar.txt"
-
-  (merge-pathnames-as-file #P"foo/" #P"./bar.txt") == #P"foo/./bar.txt"
-
-  (merge-pathnames-as-file #P"foo/" #P"/bar/README") == #P"/bar/README"
-
-  (merge-pathnames-as-file #P"/foo/" #P"/bar/" #P'quux/file.txt) == #P"/bar/quux/file.txt"
-
- -
- -


[Function] -
pathname-as-directory pathspec => pathname -


-Converts the non-wild pathname designator pathspec to directory form, i.e. it returns a pathname which would return a true value if fed to DIRECTORY-PATHNAME-P. -
- -


[Function] -
pathname-as-file pathspec => pathname - -


-Converts the non-wild pathname designator pathspec to file form, i.e. it returns a pathname which would return a NIL value if fed to DIRECTORY-PATHNAME-P. -
- -


[Function]
pathname-directory-pathname pathname => result -

-

Returns a complete pathname representing the directory of -pathname. If pathname is -already a directory pathname -(name nil, type -nil) returns a pathname equal (as -per pathname-equal) to it.

-
- -


[Function]
pathname-parent-directory pathname => result -

- -

Returns a pathname which would, by name at least, -contain pathname as one of its direct -children. Symlinks can make the parent/child relationship a like -opaque, but generally speaking the value returned by this function is -a directory name which contains pathname.

- -

The root directory, #P"/", is its own parent. The parent -directory of a filename is the parent of the filename's -dirname.

- -
- -

Traversing directories

- -


[Function] -
list-directory dirname &key follow-symlinks => list - -


-

-Returns a fresh list of pathnames corresponding to -all files within the directory named by the non-wild pathname designator dirname. The pathnames of sub-directories are returned in -directory form - see PATHNAME-AS-DIRECTORY. -

-

- If follow-symlinks is true (which is the - default), then the returned list contains truenames (symlinks will - be resolved) which essentially means that it might also return files - from outside the directory. This works on all platforms. -

-

- When follow-symlinks is NIL, it should return the actual directory - contents, which might include symlinks. (This is currently implemented only on SBCL and CCL.) -

-
- -


[Function] -
walk-directory dirname fn &key directories if-does-not-exist test follow-symlinks => | - -


-

- Recursively applies the function designated by the function - designator fn to all files within the directory named - by the non-wild pathname - designator dirname and all of its sub-directories. fn - will only be applied to files for which the function test - returns a true value. (The default value for test - always returns true.) If directories is not NIL, - fn and test are applied to directories - as well. If directories is :DEPTH-FIRST, fn - will be applied to the directory's contents first. If directories - is :BREADTH-FIRST and test returns NIL, the - directory's content will be skipped. if-does-not-exist must - be one of :ERROR or :IGNORE where :ERROR - (the default) means that an error will be signaled if the directory dirname - does not exist. -

-

- If follow-symlinks is true (which is - the default), then your callback will receive truenames. Otherwise - you should get the actual directory contents, which might include - symlinks. This might not be supported on all platforms. See - LIST-DIRECTORY. -

-
- -

Temporary Files

- -
Synopsis
- -

- Create a temporary file and return its name: -

CL-USER> (temporary-file:with-output-to-temporary-file (foo)
-           (print "hello" foo))
-#P"/var/folders/Yu/YuNMNBNPGoqs9G-1Wmj1dk+++TI/-Tmp-/temp-yjck024x"
-

-

- Create a temporary file, read and write it, have it be deleted - automatically: -

CL-USER> (temporary-file:with-open-temporary-file (foo :direction :io)
-           (print "hello" foo)
-           (file-position foo 0)
-           (read foo))
-"hello"
-

- -
Default temporary file directory
- By default, temporary files are created in a system specific - directory that defaults based on operating system conventions. On - Unix and Unix-like systems, the directory /tmp/ is used - by default. It can be overridden by setting the TMPDIR - environment variable. On Windows, the value of the environment - variable TEMP is used. If it is not set, temporary file - creation will fail. - -
Defining the temporary file directory
-

- The Lisp application can set the default directory in which - temporary files are created by the way of the - temporary-files logical pathname host: - -

(setf (logical-pathname-translations "temporary-files") '(("*.*.*" "/var/tmp/")))
- - This would set the directory for temporary files to - /var/tmp/. For more information about logical - pathnames, please refer to Common - Lisp the Language, 2nd Edition and the Common Lisp - HyperSpec. -

-

- Physical path names have restrictions regarding the permitted - character in file names. If these restrictions conflict with - your desired naming scheme, you can pass a physical pathname as - TEMPLATE parameter to the temporary file generation function. -

-

- Here are a few examples: -

CL-USER> (logical-pathname-translations "temporary-files")
-(("*.*.*" #P"/var/folders/Yu/YuNMNBNPGoqs9G-1Wmj1dk+++TI/-Tmp-/"))
-CL-USER> (temporary-file:with-open-temporary-file (foo)
-           (pathname foo))
-#P"/var/folders/Yu/YuNMNBNPGoqs9G-1Wmj1dk+++TI/-Tmp-/temp-6rdqdkd1"
- - This used the temporary directory established in the TMPDIR - environment variable, by the way of the definition of the - temporary-files logical host definition. - -
CL-USER> (temporary-file:with-open-temporary-file (foo :template "/tmp/file.with.dots.in.name.%.txt")
-           (pathname foo))
-#P"/tmp/file.with.dots.in.name.2EF04KUJ.txt"
- - Here, a physical pathname was used for the - :template keyword argument so that a - filename containing multiple dots could be generated. - -
CL-USER> (temporary-file:with-open-temporary-file (foo :template "temporary-files:blah-%.txt")
-           (pathname foo))
-#P"/var/folders/Yu/YuNMNBNPGoqs9G-1Wmj1dk+++TI/-Tmp-/blah-72mj450d.txt"
- - This used the temporary-files logical pathname host, but changed - the filename slightly. - -
CL-USER> *default-pathname-defaults*
-#P"/Users/hans/"
-CL-USER> (temporary-file:with-open-temporary-file (foo :template "blah-%.txt")
-           (pathname foo))
-#P"/Users/hans/blah-5OEJELG2.txt"
- - Here, a relative pathname was used in the template, which - caused the file to be generated in the directory established - by *default-pathname-defaults*. -

-

- Alternatively, the *default-template* - special variable can be set to define a custom default template - for generating names. -

- -
Security
- The TEMPORARY-FILE library does not directly address security - issues. The application that uses it needs to take additional - measures if it is important that files created by one process - cannot be accessed by other, unrelated processes. This can be - done by using the system dependent security mechanisms like - default file permissions or access control lists. - -
Dictionary
- - -

[Function]
open-temporary &rest open-arguments &key template generate-random-string max-tries &allow-other-keys - => - stream

-

- Create a file with a randomly generated name and return the - opened stream. The resulting pathname is generated from - template, which is a string - representing a pathname template. A percent sign (%) in - that string is replaced by a randomly generated string to - make the filename unique. The default for - template places temporary files in the - temporary-files logical pathname host, - which is automatically set up in a system specific manner. - The file name generated from template - is merged with *default-pathname-defaults*, - so random pathnames relative to that directory can be - generated by not specifying a directory in - template. -

-

- generate-random-string can be passed to - override the default function that generates the random name - component. It should return a random string consisting of - characters that are permitted in a pathname (logical or - physical, depending on template). -

-

- The name of the temporary file can be accessed calling the - pathname - function on stream. For convenience, - the temporary file is opened on the physical pathname, - i.e. if the template designate a - logical pathname the translation to a physical pathname is - performed before opening the stream. -

-

- In order to create a unique file name, - open-temporary may loop internally up - to max-tries times before giving up and - signalling a - cannot-create-temporary-file condition. -

-

- Any unrecognized keyword arguments are passed to the call to - open. -

-

-

[Macro]
with-output-to-temporary-file (stream &rest args) &body body - => - pathname

- Create a temporary file using - open-temporary with - args and run body - with stream bound to the temporary file - stream. Returns the pathname of the file that has been - created. See open-temporary for - permitted options. -

-

[Macro]
with-open-temporary-file (stream &rest args &key keep &allow-other-keys) &body body - => - values

- Create a temporary file using - open-temporary with - args and run body - with stream bound to the temporary file - stream. Returns the values returned by - body. By default, the file is deleted - when body is exited. If a true value is - passed in keep, the file is not deleted - when the body is exited. See - open-temporary for more permitted - options. -

-

- [Special variable]
*default-template*

- This variable can be set to a string representing the desired - default template for temporary file name generation. See - open-temporary for a description of the - template string format. -

-

- [Condition type]
cannot-create-temporary-file

- Signalled when an attempt to create unique temporary file name - failed after the established number of retries. -

-

- [Condition type]
invalid-temporary-pathname-template

- Signalled when the template argument to - open-temporary does not contain a valid - template string. The template string must contain a percent - sign, which is replaced by the generated random string to - yield the filename. -

-

- [Condition type]
missing-temp-environment-variable

- (Windows only) Signalled when the TEMP environment variable is - not set. -

-

- [Logical Pathname Host]
temporary-files

- This logical pathname host defines where temporary files are - stored by default. It is initialized in a suitable system - specific fashion: On Unix and Unix-like systems, the directory - specified in the TMPDIR environment variable is used. If that - variable is not set, /tmp is used as the default. On Windows, - the directory specified in the TEMP environment variable is - used. If it is not set, a - missing-temp-environment-variable error - is signalled. -

- - -

Modifying the file system

- -


[Function] -
copy-file from to &key overwrite => | - -


-Copies the file designated by the non-wild pathname designator from to the -file designated by the non-wild pathname designator to. If overwrite is true (the default is NIL) -overwrites the file designtated by to if it exists. -
- -


[Function] -
copy-stream from to &optional checkp => | - -


Copies into to (a stream) -from from (also a stream) until the end -of from is reached. The streams should have the -same element -type unless they are bivalent. If checkp is -true (which is the default), the function will signal an error if the -element types aren't the same. -
-


[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 designator dirname including -dirname itself. if-does-not-exist must be one of :ERROR or :IGNORE -where :ERROR (the default) means that an error will be signaled if the directory -dirname does not exist. -

-

- Warning: this function might remove files from outside the - directory, if the directory that you are deleting contains links to - external files. This is currently fixed for SBCL and CCL. -

-
- -

The PATH package

- -


[Package] -
(defpackage path) - -

-Provides a set of short names for commonly used pathname manipulation -functions (these are all functions from the cl-fad -package which are being exported under different names): -
-
dirname
pathname-as-directory
-
basename
cl:file-namestring
-
-e
file-exists-p
-
-d
directory-exists-p
-
catfile
merge-pathnames-as-file
-
catdir
merge-pathnames-as-directory
-
rm-r
delete-directory-and-files
-
=
pathname-equal
-
absolute-p
pathname-absolute-p
-
relative-p
pathname-relative-p
-
root-p
pathname-root-p
-
-
- - -
 

Acknowledgements

- -The original code for this library was written by Peter Seibel for his -book Practical Common -Lisp. I added some stuff and made sure it worked properly on -Windows, specifically with CCL. Thanks to James Bielman, Maciek -Pasternacki, Jack D. Unrue, Gary King, and Douglas Crosher who sent -patches for OpenMCL, ECL, ABCL, MCL, and Scieneer CL. - -

-$Header: /usr/local/cvsrep/cl-fad/doc/index.html,v 1.33 2009/09/30 14:23:12 edi Exp $ -

BACK TO MY HOMEPAGE - - - - diff -pruN 0.7.4-1/docs/index.html 20180430-1/docs/index.html --- 0.7.4-1/docs/index.html 1970-01-01 00:00:00.000000000 +0000 +++ 20180430-1/docs/index.html 2018-04-14 13:32:16.000000000 +0000 @@ -0,0 +1,700 @@ + + + + + + CL-FAD - A portable pathname library for Common Lisp + + + + + +

CL-FAD - A portable pathname library for Common Lisp

+ +
+
 

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. +

+ +
 

Contents

+
    +
  1. Download and installation +
  2. Supported Lisp implementations +
  3. The CL-FAD dictionary +
      +
    1. Querying files, directories and pathnames +
        +
      1. directory-exists-p [function] +
      2. directory-pathname-p [function] +
      3. file-exists-p [function] +
      4. pathname-absolute-p [function] +
      5. pathname-equal [function] +
      6. pathname-relative-p [function] +
      7. pathname-root-p [function] +
    2. +
    3. Manipulating pathnames +
        +
      1. canonical-pathname [function] +
      2. merge-pathnames-as-directory [function] +
      3. merge-pathnames-as-file [function] +
      4. pathname-as-directory [function] +
      5. pathname-as-file [function] +
      6. pathname-directory-pathname [function] +
      7. pathname-parent-directory [function] +
    4. +
    5. Traversing directories +
        +
      1. list-directory [function] +
      2. walk-directory [function] +
    6. +
    7. Temporary Files +
        +
      1. open-temporary [function] +
      2. with-output-to-temporary-file [macro] +
      3. with-open-temporary-file [macro] +
      4. *default-template* [variable] +
      5. cannot-create-temporary-file [condition] +
      6. invalid-temporary-pathname-template [condition] +
      7. missing-temp-environment-variable [condition] +
      8. temporary-files [logical pathname host] +
      +
    8. +
    9. Modifying the file system +
        +
      1. copy-file [function] +
      2. copy-stream [function] +
      3. delete-directory-and-files [function] +
    10. +
    11. path [package] +
    +
  4. Acknowledgements +
+ + + +
 

Download and installation

+ +CL-FAD together with this documentation can be downloaded from https://github.com/edicl/cl-fad/releases/latest. The +current version is 0.7.5. +

+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 latest version of the source code lives in the github repository edicl/cl-fad. + +If you want to send patches, +please read this first. +Please submit your changes +as GitHub pull +request". + +
 

Supported Lisp implementations

+ +

+The following Common Lisp implementations are currently supported: +

+ +I'll gladly accepts patches to make CL-FAD work on other platforms. + + +
 

The CL-FAD dictionary

+ +

Querying files, directories and pathnames

+ +


[Function] +
directory-exists-p pathspec => generalized-boolean + +


+Checks whether the file named by the pathname designator pathspec +exists and if it is a directory. Returns its truename if this is the +case, NIL otherwise. The truename is returned in directory form as if +by PATHNAME-AS-DIRECTORY. +
+ +


[Function] +
directory-pathname-p pathspec => generalized-boolean + +


+Returns NIL if pathspec (a pathname designator) does not designate +a directory, pathspec otherwise. It is irrelevant whether the file or +directory designated by pathspec does actually exist. +
+ +


[Function] +
file-exists-p pathspec => generalized-boolean + +


+Checks whether the file named by the pathname designator pathspec +exists and returns its truename if this is the case, NIL otherwise. +The truename is returned in "canonical" form, i.e. the truename of a +directory is returned in directory form as if by PATHNAME-AS-DIRECTORY. +
+ +


[Function]
pathname-absolute-p a => result +

+

Returns true if a is an absolute pathname. This simply +tests if a's directory list starts with :ABSOLUTE

+
+ +


[Function]
pathname-equal a b => result +

+ +

Returns true if a and b +represent the same pathname. This function does not access the +filesystem, it only looks at the components of the two pathnames to +test if they are the same (though by passing both a +and b to probe-file one can make this function test for +file 'sameness'.

+ +

Equality is defined as:

+ +
    +
  • strings that are string= +
  • symbols (including nil and keywords) which are eql +
  • lists of the same length with equal (as per these rules) elements. +
+ +

If any of these tree conditions is false for any of the components in +a and b then a +and b are different, otherwise they are the same.

+ +

NB: This function does not convert name strings to pathnames. So +"foo.txt" and #P"foo.txt" are different pathnames.

+ +
+ +


[Function]
pathname-relative-p a => result +

+

Returns true if a is a relative pathname. This simply +tests if a's directory starts +with :RELATIVE.

+
+ +


[Function]
pathname-root-p a => result +

+

Returns true if pathname is the root +directory (in other words, a directory which is its own parent).

+
+ +

Manipulating pathnames

+ +


[Function]
canonical-pathname pathname => result +

+

Remove redundant information from PATHNAME.

+ +

This simply walks down PATHNAME's +pathname-directory and drops "." directories, removes :back +and its preceding element.

+ +

NB: This function does not access the filesystem, it only looks at the +values in the pathname and works on their known (or assumed) +meanings.

+ +

NB: Since this function does not access the filesystem it will only +remove :BACK elements from the path (not :UP +elements). Since some lisps, ccl/sbcl/clisp convert ".." in +pathnames to :UP, and not :BACK, the actual +utility of the function is limited.

+
+ +


[Function]
merge-pathnames-as-directory &rest pathnames => result +

+

Given a list of (probably relative) pathnames, this returns a single +directory pathname containing the logical concatenation of them all.

+ +

The returned value is the current directory if one were to cd into +each of pathnames in order. For this reason an +absolute pathname will, effectively, cancel the affect of any previous +relative pathnames.

+ +

The returned value's defaults are taken from the first element of +pathnames (host, version and device).

+ +

NB: Since this function only looks at directory names the name and +type of the elements of pathnames are ignored. Make sure to properly +use either trailing #\/s, or pathname-as-directory, to get the +expected results.

+ +

Examples:

+ +
+  (merge-pathnames-as-directory #P"foo/" #P"bar/") == #P"foo/bar/"
+
+  (merge-pathnames-as-directory #P"foo/" #P"./bar/") == #P"foo/./bar/"
+
+  (merge-pathnames-as-directory #P"foo/" #P"/bar/") == #P"/bar/"
+
+  (merge-pathnames-as-directory #P"foo/" #P"/bar/" #P'quux/file.txt) == #P"/bar/quux/"
+
+ +
+ +


[Function]
merge-pathnames-as-file &rest pathnames => result +

+

Given a list of, probably relative, pathnames returns a single +filename pathname containing the logical concatenation of them all.

+ +

The returned value's defaults are taken from the first element of +pathnames (host, version and device). The returned +values's name, type and version are taken from the last element +of pathnames. The intervening elements are used only for +their pathname-directory values.

+ +Examples: + +
+  (merge-pathnames-as-file #P"foo/" #P"bar.txt") == #P"foo/bar.txt"
+
+  (merge-pathnames-as-file #P"foo/" #P"./bar.txt") == #P"foo/./bar.txt"
+
+  (merge-pathnames-as-file #P"foo/" #P"/bar/README") == #P"/bar/README"
+
+  (merge-pathnames-as-file #P"/foo/" #P"/bar/" #P'quux/file.txt) == #P"/bar/quux/file.txt"
+
+ +
+ +


[Function] +
pathname-as-directory pathspec => pathname +


+Converts the non-wild pathname designator pathspec to directory form, i.e. it returns a pathname which would return a true value if fed to DIRECTORY-PATHNAME-P. +
+ +


[Function] +
pathname-as-file pathspec => pathname + +


+Converts the non-wild pathname designator pathspec to file form, i.e. it returns a pathname which would return a NIL value if fed to DIRECTORY-PATHNAME-P. +
+ +


[Function]
pathname-directory-pathname pathname => result +

+

Returns a complete pathname representing the directory of +pathname. If pathname is +already a directory pathname +(name nil, type +nil) returns a pathname equal (as +per pathname-equal) to it.

+
+ +


[Function]
pathname-parent-directory pathname => result +

+ +

Returns a pathname which would, by name at least, +contain pathname as one of its direct +children. Symlinks can make the parent/child relationship a like +opaque, but generally speaking the value returned by this function is +a directory name which contains pathname.

+ +

The root directory, #P"/", is its own parent. The parent +directory of a filename is the parent of the filename's +dirname.

+ +
+ +

Traversing directories

+ +


[Function] +
list-directory dirname &key follow-symlinks => list + +


+

+Returns a fresh list of pathnames corresponding to +all files within the directory named by the non-wild pathname designator dirname. The pathnames of sub-directories are returned in +directory form - see PATHNAME-AS-DIRECTORY. +

+

+ If follow-symlinks is true (which is the + default), then the returned list contains truenames (symlinks will + be resolved) which essentially means that it might also return files + from outside the directory. This works on all platforms. +

+

+ When follow-symlinks is NIL, it should return the actual directory + contents, which might include symlinks. (This is currently implemented only on SBCL and CCL.) +

+
+ +


[Function] +
walk-directory dirname fn &key directories if-does-not-exist test follow-symlinks => | + +


+

+ Recursively applies the function designated by the function + designator fn to all files within the directory named + by the non-wild pathname + designator dirname and all of its sub-directories. fn + will only be applied to files for which the function test + returns a true value. (The default value for test + always returns true.) If directories is not NIL, + fn and test are applied to directories + as well. If directories is :DEPTH-FIRST, fn + will be applied to the directory's contents first. If directories + is :BREADTH-FIRST and test returns NIL, the + directory's content will be skipped. if-does-not-exist must + be one of :ERROR or :IGNORE where :ERROR + (the default) means that an error will be signaled if the directory dirname + does not exist. +

+

+ If follow-symlinks is true (which is + the default), then your callback will receive truenames. Otherwise + you should get the actual directory contents, which might include + symlinks. This might not be supported on all platforms. See + LIST-DIRECTORY. +

+
+ +

Temporary Files

+ +
Synopsis
+ +

+ Create a temporary file and return its name: +

CL-USER> (temporary-file:with-output-to-temporary-file (foo)
+           (print "hello" foo))
+#P"/var/folders/Yu/YuNMNBNPGoqs9G-1Wmj1dk+++TI/-Tmp-/temp-yjck024x"
+

+

+ Create a temporary file, read and write it, have it be deleted + automatically: +

CL-USER> (temporary-file:with-open-temporary-file (foo :direction :io)
+           (print "hello" foo)
+           (file-position foo 0)
+           (read foo))
+"hello"
+

+ +
Default temporary file directory
+ By default, temporary files are created in a system specific + directory that defaults based on operating system conventions. On + Unix and Unix-like systems, the directory /tmp/ is used + by default. It can be overridden by setting the TMPDIR + environment variable. On Windows, the value of the environment + variable TEMP is used. If it is not set, temporary file + creation will fail. + +
Defining the temporary file directory
+

+ The Lisp application can set the default directory in which + temporary files are created by the way of the + temporary-files logical pathname host: + +

(setf (logical-pathname-translations "temporary-files") '(("*.*.*" "/var/tmp/")))
+ + This would set the directory for temporary files to + /var/tmp/. For more information about logical + pathnames, please refer to Common + Lisp the Language, 2nd Edition and the Common Lisp + HyperSpec. +

+

+ Physical path names have restrictions regarding the permitted + character in file names. If these restrictions conflict with + your desired naming scheme, you can pass a physical pathname as + TEMPLATE parameter to the temporary file generation function. +

+

+ Here are a few examples: +

CL-USER> (logical-pathname-translations "temporary-files")
+(("*.*.*" #P"/var/folders/Yu/YuNMNBNPGoqs9G-1Wmj1dk+++TI/-Tmp-/"))
+CL-USER> (temporary-file:with-open-temporary-file (foo)
+           (pathname foo))
+#P"/var/folders/Yu/YuNMNBNPGoqs9G-1Wmj1dk+++TI/-Tmp-/temp-6rdqdkd1"
+ + This used the temporary directory established in the TMPDIR + environment variable, by the way of the definition of the + temporary-files logical host definition. + +
CL-USER> (temporary-file:with-open-temporary-file (foo :template "/tmp/file.with.dots.in.name.%.txt")
+           (pathname foo))
+#P"/tmp/file.with.dots.in.name.2EF04KUJ.txt"
+ + Here, a physical pathname was used for the + :template keyword argument so that a + filename containing multiple dots could be generated. + +
CL-USER> (temporary-file:with-open-temporary-file (foo :template "temporary-files:blah-%.txt")
+           (pathname foo))
+#P"/var/folders/Yu/YuNMNBNPGoqs9G-1Wmj1dk+++TI/-Tmp-/blah-72mj450d.txt"
+ + This used the temporary-files logical pathname host, but changed + the filename slightly. + +
CL-USER> *default-pathname-defaults*
+#P"/Users/hans/"
+CL-USER> (temporary-file:with-open-temporary-file (foo :template "blah-%.txt")
+           (pathname foo))
+#P"/Users/hans/blah-5OEJELG2.txt"
+ + Here, a relative pathname was used in the template, which + caused the file to be generated in the directory established + by *default-pathname-defaults*. +

+

+ Alternatively, the *default-template* + special variable can be set to define a custom default template + for generating names. +

+ +
Security
+ The TEMPORARY-FILE library does not directly address security + issues. The application that uses it needs to take additional + measures if it is important that files created by one process + cannot be accessed by other, unrelated processes. This can be + done by using the system dependent security mechanisms like + default file permissions or access control lists. + +
Dictionary
+ + +

[Function]
open-temporary &rest open-arguments &key template generate-random-string max-tries &allow-other-keys + => + stream

+

+ Create a file with a randomly generated name and return the + opened stream. The resulting pathname is generated from + template, which is a string + representing a pathname template. A percent sign (%) in + that string is replaced by a randomly generated string to + make the filename unique. The default for + template places temporary files in the + temporary-files logical pathname host, + which is automatically set up in a system specific manner. + The file name generated from template + is merged with *default-pathname-defaults*, + so random pathnames relative to that directory can be + generated by not specifying a directory in + template. +

+

+ generate-random-string can be passed to + override the default function that generates the random name + component. It should return a random string consisting of + characters that are permitted in a pathname (logical or + physical, depending on template). +

+

+ The name of the temporary file can be accessed calling the + pathname + function on stream. For convenience, + the temporary file is opened on the physical pathname, + i.e. if the template designate a + logical pathname the translation to a physical pathname is + performed before opening the stream. +

+

+ In order to create a unique file name, + open-temporary may loop internally up + to max-tries times before giving up and + signalling a + cannot-create-temporary-file condition. +

+

+ Any unrecognized keyword arguments are passed to the call to + open. +

+

+

[Macro]
with-output-to-temporary-file (stream &rest args) &body body + => + pathname

+ Create a temporary file using + open-temporary with + args and run body + with stream bound to the temporary file + stream. Returns the pathname of the file that has been + created. See open-temporary for + permitted options. +

+

[Macro]
with-open-temporary-file (stream &rest args &key keep &allow-other-keys) &body body + => + values

+ Create a temporary file using + open-temporary with + args and run body + with stream bound to the temporary file + stream. Returns the values returned by + body. By default, the file is deleted + when body is exited. If a true value is + passed in keep, the file is not deleted + when the body is exited. See + open-temporary for more permitted + options. +

+

+ [Special variable]
*default-template*

+ This variable can be set to a string representing the desired + default template for temporary file name generation. See + open-temporary for a description of the + template string format. +

+

+ [Condition type]
cannot-create-temporary-file

+ Signalled when an attempt to create unique temporary file name + failed after the established number of retries. +

+

+ [Condition type]
invalid-temporary-pathname-template

+ Signalled when the template argument to + open-temporary does not contain a valid + template string. The template string must contain a percent + sign, which is replaced by the generated random string to + yield the filename. +

+

+ [Condition type]
missing-temp-environment-variable

+ (Windows only) Signalled when the TEMP environment variable is + not set. +

+

+ [Logical Pathname Host]
temporary-files

+ This logical pathname host defines where temporary files are + stored by default. It is initialized in a suitable system + specific fashion: On Unix and Unix-like systems, the directory + specified in the TMPDIR environment variable is used. If that + variable is not set, /tmp is used as the default. On Windows, + the directory specified in the TEMP environment variable is + used. If it is not set, a + missing-temp-environment-variable error + is signalled. +

+ + +

Modifying the file system

+ +


[Function] +
copy-file from to &key overwrite => | + +


+Copies the file designated by the non-wild pathname designator from to the +file designated by the non-wild pathname designator to. If overwrite is true (the default is NIL) +overwrites the file designated by to if it exists. +
+ +


[Function] +
copy-stream from to &optional checkp => | + +


Copies into to (a stream) +from from (also a stream) until the end +of from is reached. The streams should have the +same element +type unless they are bivalent. If checkp is +true (which is the default), the function will signal an error if the +element types aren't the same. +
+


[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 designator dirname including +dirname itself. if-does-not-exist must be one of :ERROR or :IGNORE +where :ERROR (the default) means that an error will be signaled if the directory +dirname does not exist. +

+

+ Warning: this function might remove files from outside the + directory, if the directory that you are deleting contains links to + external files. This is currently fixed for SBCL and CCL. +

+
+ +

The PATH package

+ +


[Package] +
(defpackage path) + +

+Provides a set of short names for commonly used pathname manipulation +functions (these are all functions from the cl-fad +package which are being exported under different names): +
+
dirname
pathname-as-directory
+
basename
cl:file-namestring
+
-e
file-exists-p
+
-d
directory-exists-p
+
catfile
merge-pathnames-as-file
+
catdir
merge-pathnames-as-directory
+
rm-r
delete-directory-and-files
+
=
pathname-equal
+
absolute-p
pathname-absolute-p
+
relative-p
pathname-relative-p
+
root-p
pathname-root-p
+
+
+ + +
 

Acknowledgements

+ +The original code for this library was written by Peter Seibel for his +book Practical Common +Lisp. I added some stuff and made sure it worked properly on +Windows, specifically with CCL. Thanks to James Bielman, Maciek +Pasternacki, Jack D. Unrue, Gary King, and Douglas Crosher who sent +patches for OpenMCL, ECL, ABCL, MCL, and Scieneer CL. + +

+$Header: /usr/local/cvsrep/cl-fad/doc/index.html,v 1.33 2009/09/30 14:23:12 edi Exp $ +

BACK TO MY HOMEPAGE + + + + diff -pruN 0.7.4-1/fad.lisp 20180430-1/fad.lisp --- 0.7.4-1/fad.lisp 2016-07-10 19:12:08.000000000 +0000 +++ 20180430-1/fad.lisp 2018-04-14 13:32:16.000000000 +0000 @@ -97,12 +97,12 @@ and CCL." (declare (ignorable follow-symlinks)) (when (wild-pathname-p dirname) (error "Can only list concrete directory names.")) - #+:ecl + #+(or :ecl :clasp) (let ((dir (pathname-as-directory dirname))) (concatenate 'list (directory (merge-pathnames (pathname "*/") dir)) (directory (merge-pathnames (pathname "*.*") dir)))) - #-:ecl + #-(or :ecl :clasp) (let ((wildcard (directory-wildcard dirname))) #+:abcl (system::list-directory dirname) #+:sbcl (directory wildcard :resolve-symlinks follow-symlinks) @@ -113,7 +113,7 @@ and CCL." (directory (clisp-subdirectories-wildcard wildcard))) #+:cormanlisp (nconc (directory wildcard) (cl::directory-subdirs dirname))) - #-(or :sbcl :cmu :scl :lispworks :openmcl :allegro :clisp :cormanlisp :ecl :abcl :digitool) + #-(or :sbcl :cmu :scl :lispworks :openmcl :allegro :clisp :cormanlisp :ecl :abcl :digitool :clasp) (error "LIST-DIRECTORY not implemented")) (defun pathname-as-file (pathspec) @@ -135,7 +135,7 @@ and CCL." exists and returns its truename if this is the case, NIL otherwise. The truename is returned in `canonical' form, i.e. the truename of a directory is returned as if by PATHNAME-AS-DIRECTORY." - #+(or :sbcl :lispworks :openmcl :ecl :digitool) (probe-file pathspec) + #+(or :sbcl :lispworks :openmcl :ecl :digitool clasp) (probe-file pathspec) #+:allegro (or (excl:probe-directory (pathname-as-directory pathspec)) (probe-file pathspec)) #+(or :cmu :scl :abcl) (or (probe-file (pathname-as-directory pathspec)) @@ -146,10 +146,10 @@ directory is returned as if by PATHNAME- #+:clisp (or (ignore-errors (let ((directory-form (pathname-as-directory pathspec))) (when (ext:probe-directory directory-form) - directory-form))) + (truename directory-form)))) (ignore-errors (probe-file (pathname-as-file pathspec)))) - #-(or :sbcl :cmu :scl :lispworks :openmcl :allegro :clisp :cormanlisp :ecl :abcl :digitool) + #-(or :sbcl :cmu :scl :lispworks :openmcl :allegro :clisp :cormanlisp :ecl :abcl :digitool :clasp) (error "FILE-EXISTS-P not implemented")) (defun directory-exists-p (pathspec) @@ -242,7 +242,7 @@ checked for compatibility of their types (defun copy-file (from to &key overwrite) "Copies the file designated by the non-wild pathname designator FROM to the file designated by the non-wild pathname designator TO. If -OVERWRITE is true overwrites the file designtated by TO if it exists." +OVERWRITE is true overwrites the file designated by TO if it exists." #+:allegro (excl.osi:copy-file from to :overwrite overwrite) #-:allegro (let ((element-type #-:cormanlisp '(unsigned-byte 8) @@ -309,6 +309,7 @@ might be removed instead! This is curre #+:openmcl (cl-fad-ccl:delete-directory file) #+:cormanlisp (win32:delete-directory file) #+:ecl (si:rmdir file) + #+:clasp (core:rmdir file) #+(or :abcl :digitool) (delete-file file)) (t (delete-file file)))) :follow-symlinks nil @@ -340,7 +341,7 @@ of a filename is the parent of the filen (list :back)))))) (defun canonical-pathname (pathname) - "Remove reduntant information from PATHNAME. + "Remove redundant information from PATHNAME. This simply walks down PATHNAME's pathname-directory and drops \".\" directories, removes :back and its preceding element. @@ -371,7 +372,7 @@ not :BACK, the actual utility of the fun finally (return (make-pathname :defaults pathname :directory (nreverse canon-dir)))))) (defun merge-pathnames-as-directory (&rest pathnames) - "Given a list of, probably relative, pathnames returns a single + "Given a list of (probably relative) pathnames, this returns a single directory pathname containing the logical concatenation of them all. The returned value is the current directory if one were to cd into @@ -391,25 +392,24 @@ Examples: (merge-pathnames-as-directory #P\"foo/\" #P\"bar/\") == #P\"foo/bar/\" (merge-pathnames-as-directory #P\"foo/\" #P\"./bar/\") == #P\"foo/./bar/\" (merge-pathnames-as-directory #P\"foo/\" #P\"/bar/\") == #P\"/bar/\" - (merge-pathnames-as-directory #P\"foo/\" #P\"/bar/\" #P'quux/file.txt) == #P\"/bar/quux/\" + (merge-pathnames-as-directory #P\"foo/\" #P\"/bar/\" #P\"quux/file.txt\") == #P\"/bar/quux/\" " - (when (null pathnames) - (return-from merge-pathnames-as-directory - (make-pathname :defaults *default-pathname-defaults* :directory nil :name nil :type nil))) - (let* ((pathnames (mapcar #'pathname pathnames))) - (loop - with defaults = (first pathnames) - with dir = (pathname-directory defaults) - for pathname in (rest pathnames) - for type = (first (pathname-directory pathname)) - do (ecase type - ((nil) ;; this is equivalent to (:relative) == ".", so, for this function, just do nothing. - ) - (:absolute - (setf dir (pathname-directory pathname))) - (:relative - (setf dir (append dir (rest (pathname-directory pathname)))))) - finally (return (make-pathname :defaults defaults :directory dir :name nil :type nil))))) + (if pathnames + (let* ((pathnames (mapcar #'pathname pathnames)) + (defaults (first pathnames)) + (dir (pathname-directory defaults))) + (loop for pathname in (rest pathnames) + for directory = (pathname-directory pathname) + do (ecase (first directory) + ;; this is equivalent to (:relative) == ".", so, + ;; for this function, just do nothing. + ((nil)) + (:absolute + (setf dir directory)) + (:relative + (setf dir (append dir (rest directory)))))) + (make-pathname :defaults defaults :directory dir :name nil :type nil)) + (make-pathname))) (defun merge-pathnames-as-file (&rest pathnames) "Given a list of, probably relative, pathnames returns a single @@ -426,27 +426,18 @@ Examples: (merge-pathnames-as-file #P\"foo/\" #P\"bar.txt\") == #P\"foo/bar.txt\" (merge-pathnames-as-file #P\"foo/\" #P\"./bar.txt\") == #P\"foo/./bar.txt\" (merge-pathnames-as-file #P\"foo/\" #P\"/bar/README\") == #P\"/bar/README\" - (merge-pathnames-as-file #P\"/foo/\" #P\"/bar/\" #P'quux/file.txt) == #P\"/bar/quux/file.txt\" + (merge-pathnames-as-file #P\"/foo/\" #P\"/bar/\" #P\"quux/file.txt\") == #P\"/bar/quux/file.txt\" " - (case (length pathnames) - (0 - (when (null pathnames) - (make-pathname :defaults *default-pathname-defaults* - :directory nil - :name nil - :type nil))) - (1 - (pathname-as-file (first pathnames))) - (t - (let* ((defaults (pop pathnames)) - (file-name-part (first (last pathnames))) - (file-name-directory (make-pathname :defaults file-name-part - :name nil :type nil)) - (pathnames (butlast pathnames))) - (make-pathname :defaults (apply #'merge-pathnames-as-directory (append (list defaults) pathnames (list file-name-directory))) - :name (pathname-name file-name-part) - :type (pathname-type file-name-part) - :version (pathname-version file-name-part)))))) + (cond ((null pathnames) + (make-pathname)) + ((null (cdr pathnames)) + (pathname-as-file (first pathnames))) + (t + (let ((file-name-part (first (last pathnames)))) + (make-pathname :defaults (apply #'merge-pathnames-as-directory pathnames) + :name (pathname-name file-name-part) + :type (pathname-type file-name-part) + :version (pathname-version file-name-part)))))) (defmacro with-component-testers ((a b key) &body body) (let ((k (gensym))) @@ -455,21 +446,18 @@ Examples: (,b (funcall ,k ,b))) (labels ((components-are (test) (and (funcall test ,a) (funcall test ,b))) - (components-are-member (values) (and (member ,a values :test #'eql) (member ,b values :test #'eql) (eql ,a ,b))) - (components-are-string= () (and (stringp ,a) (stringp ,b) (string= ,a ,b))) - (components-are-every (test) (and (consp ,a) (consp ,b) (every test ,a ,b)))) - - + (declare (ignorable #'components-are #'components-are-member + #'components-are-string= #'components-are-every)) (if (or ,@body) (values t ,a ,b) nil))))) @@ -479,9 +467,7 @@ Examples: (eq a b) (components-are-member '(nil :unspecific)) (components-are-string=) - (and (consp a) - (consp b) - (components-are-every #'string=)))) + (components-are-every #'string=))) (defun pathname-device-equal (a b) (with-component-testers (a b #'pathname-device) diff -pruN 0.7.4-1/README 20180430-1/README --- 0.7.4-1/README 2016-07-10 19:12:08.000000000 +0000 +++ 20180430-1/README 2018-04-14 13:32:16.000000000 +0000 @@ -1,5 +1,5 @@ -Complete documentation for CL-FAD can be found in the 'doc' -directory. +Complete documentation for CL-FAD can be found in the 'docs' +directory or at . CL-FAD also supports Nikodemus Siivola's HYPERDOC, see and @@ -28,6 +28,10 @@ CL-FAD also supports Nikodemus Siivola's 1.3. You can also use ASDF instead of MK:DEFSYSTEM in a similar way (use the .asd files instead of the .system files). +1.4. Via QuickLisp: + + (ql:quickload :cl-fad) + 2. Test CL-FAD comes with a small test suite. To start it just load the file diff -pruN 0.7.4-1/temporary-files.lisp 20180430-1/temporary-files.lisp --- 0.7.4-1/temporary-files.lisp 2016-07-10 19:12:08.000000000 +0000 +++ 20180430-1/temporary-files.lisp 2018-04-14 13:32:16.000000000 +0000 @@ -33,7 +33,8 @@ (unless (ccl:%null-ptr-p value) (ccl:%get-cstring value)))) #+sbcl (sb-ext:posix-getenv x) - #-(or abcl allegro clisp clozure cmu cormanlisp ecl gcl lispworks mcl sbcl scl xcl) + #+clasp (ext:getenv x) + #-(or abcl allegro clisp clozure cmu cormanlisp ecl gcl lispworks mcl sbcl scl xcl clasp) (error "~S is not supported on your implementation" 'getenv)) (defun directory-from-environment (environment-variable-name) @@ -56,10 +57,8 @@ #-win32 (defun get-default-temporary-directory () (or (directory-from-environment "TMPDIR") - #-clisp - (probe-file #P"/tmp/") - #+clisp - (and (ext:probe-directory #P"/tmp/") + (and #-clisp (probe-file #P"/tmp/") + #+clisp (ext:probe-directory #P"/tmp/") #P"/tmp/"))) (handler-case