Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
asdf
asdf
Commits
6fd3151e
Commit
6fd3151e
authored
Feb 01, 2014
by
Francois-Rene Rideau
Browse files
Workaround duplicate entries returned by clisp for (directory-files "~/")
parent
ffe14b71
Changes
1
Hide whitespace changes
Inline
Side-by-side
uiop/filesystem.lisp
View file @
6fd3151e
...
@@ -166,22 +166,25 @@ Try to override the defaults to not resolving symlinks, if implementation allows
...
@@ -166,22 +166,25 @@ Try to override the defaults to not resolving symlinks, if implementation allows
"Given ENTRIES in a DIRECTORY, remove if the directory is logical
"Given ENTRIES in a DIRECTORY, remove if the directory is logical
the entries which are physical yet when transformed by MERGER have a different TRUENAME.
the entries which are physical yet when transformed by MERGER have a different TRUENAME.
This function is used as a helper to DIRECTORY-FILES to avoid invalid entries when using logical-pathnames."
This function is used as a helper to DIRECTORY-FILES to avoid invalid entries when using logical-pathnames."
(
if
(
logical-pathname-p
directory
)
(
remove-duplicates
;; on CLISP, querying ~/ will return duplicates
;; Try hard to not resolve logical-pathname into physical pathnames;
(
if
(
logical-pathname-p
directory
)
;; otherwise logical-pathname users/lovers will be disappointed.
;; Try hard to not resolve logical-pathname into physical pathnames;
;; If directory* could use some implementation-dependent magic,
;; otherwise logical-pathname users/lovers will be disappointed.
;; we will have logical pathnames already; otherwise,
;; If directory* could use some implementation-dependent magic,
;; we only keep pathnames for which specifying the name and
;; we will have logical pathnames already; otherwise,
;; translating the LPN commute.
;; we only keep pathnames for which specifying the name and
(
loop
:for
f
:in
entries
;; translating the LPN commute.
:for
p
=
(
or
(
and
(
logical-pathname-p
f
)
f
)
(
loop
:for
f
:in
entries
(
let*
((
u
(
ignore-errors
(
call-function
merger
f
))))
:for
p
=
(
or
(
and
(
logical-pathname-p
f
)
f
)
;; The first u avoids a cumbersome (truename u) error.
(
let*
((
u
(
ignore-errors
(
call-function
merger
f
))))
;; At this point f should already be a truename,
;; The first u avoids a cumbersome (truename u) error.
;; but isn't quite in CLISP, for it doesn't have :version :newest
;; At this point f should already be a truename,
(
and
u
(
equal
(
truename*
u
)
(
truename*
f
))
u
)))
;; but isn't quite in CLISP, for it doesn't have :version :newest
:when
p
:collect
p
)
(
and
u
(
equal
(
truename*
u
)
(
truename*
f
))
u
)))
entries
))
:when
p
:collect
p
)
entries
)
:test
'pathname-equal
))
(
defun
directory-files
(
directory
&optional
(
pattern
*wild-file*
))
(
defun
directory-files
(
directory
&optional
(
pattern
*wild-file*
))
"Return a list of the files in a directory according to the PATTERN,
"Return a list of the files in a directory according to the PATTERN,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment