Skip to content

Commit

Permalink
fix pathname-parent-directory for filenames (#14)
Browse files Browse the repository at this point in the history
* fix pathname-parent-directory for filenames

Before:
[5]> (pathname-parent-directory #P"/a/b/c")
#P"/a/c"
which is meaningless and disagrees with the function's docstring.
After:
[7]> (pathname-parent-directory #P"/a/b/c")
#P"/a/"
which agrees with the function's docstring, "The parent directory of a filename is the parent of the filename's dirname."

* better fix for pathname-parent-directory

We do want the defaults for volume and host. So it's better to just specify nil name and type.
  • Loading branch information
vibs29 committed Jan 10, 2022
1 parent 539a9fe commit 3f4d32d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fad.lisp
Expand Up @@ -335,6 +335,8 @@ The root directory, #P\"/\", is its own parent. The parent directory
of a filename is the parent of the filename's dirname."
(canonical-pathname
(make-pathname :defaults pathname
:name nil
:type nil
:directory (if (pathname-root-p pathname)
(list :absolute)
(append (or (pathname-directory pathname)
Expand Down

0 comments on commit 3f4d32d

Please sign in to comment.