diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-10-10 11:46:30 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-10-10 11:46:30 -0700 |
commit | 620a3aa8354070d29e4fd32756eff25cb5ef378f (patch) | |
tree | eeaa828a050454a3128fa6b01e83fa4004f03eb0 /stdlib | |
parent | 1b6d4d6e56607752b5ba5b465f943a3270c9f311 (diff) | |
download | txr-620a3aa8354070d29e4fd32756eff25cb5ef378f.tar.gz txr-620a3aa8354070d29e4fd32756eff25cb5ef378f.tar.bz2 txr-620a3aa8354070d29e4fd32756eff25cb5ef378f.zip |
New path-equal function.
* lisplib.c (copy_file_set_entries): Add path-equal to autoload symbols.
* stdlib/copy-file.tl (path-equal): New function.
* tests/018/path-equal.tl: New file.
* txr.1: Documented.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/copy-file.tl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/stdlib/copy-file.tl b/stdlib/copy-file.tl index fcb7f40c..c8cbe59f 100644 --- a/stdlib/copy-file.tl +++ b/stdlib/copy-file.tl @@ -246,3 +246,17 @@ (down [tcomp ncommon..:])) (cat-str (append (repeat '("..") nup) down) [path-sep-chars 0])))))) + +(defun path-equal (left right) + (cond + ((and (stringp left) (equal left right))) + ((neq (abs-path-p left) (abs-path-p right)) nil) + ((and (macro-time (find #\\ path-sep-chars)) + (if-match `@{fdrv #/[A-Za-z0-9]+:/}@nil` left + (if-match `@{tdrv #/[A-Za-z0-9]+:/}@nil` right + (nequal fdrv tdrv)))) + nil) + (t (let* ((fcomp (path-simplify (spl path-sep-chars left))) + (tcomp (path-simplify (spl path-sep-chars right))) + (ncommon (mismatch fcomp tcomp))) + (null ncommon))))) |