diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-07-30 12:06:21 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-07-30 12:06:21 -0700 |
commit | 9650fbc008dd1aaf10967ef367e5feb08f98937a (patch) | |
tree | 63969c7e400a49227a7295c61a1c9024cfbc0b56 /stdlib | |
parent | 9780ab12e6fa9f2f6bd3bc4f9f476c5df382c445 (diff) | |
download | txr-9650fbc008dd1aaf10967ef367e5feb08f98937a.tar.gz txr-9650fbc008dd1aaf10967ef367e5feb08f98937a.tar.bz2 txr-9650fbc008dd1aaf10967ef367e5feb08f98937a.zip |
path-components-safe: handle consecutive slashes.
* stdlib/path-test (path-components-safe): Remove empty
components from split path.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/path-test.tl | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/stdlib/path-test.tl b/stdlib/path-test.tl index c750841e..c0b4ea3e 100644 --- a/stdlib/path-test.tl +++ b/stdlib/path-test.tl @@ -204,8 +204,7 @@ (if-native-windows t (let* ((abs-p (abs-path-p path)) - (comps (sspl path-sep-chars path)) - (comps (if abs-p (cdr comps) comps)) + (comps (remqual "" (sspl path-sep-chars path))) (start (if abs-p "/" "."))) (if (and (nullify path) @@ -228,8 +227,7 @@ (eql st.uid (geteuid))) (let* ((target (readlink nxpath)) (abs-p (abs-path-p target)) - (tcomps (sspl path-sep-chars target)) - (tcomps (if abs-p (cdr tcomps) tcomps))) + (tcomps (remqual "" (sspl path-sep-chars target)))) (when abs-p (set start "/" ok (and (safe-abs-path comps) |