From 72361e8c3aa8a33e1ea71e2fe081362670940fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 10 Sep 2023 17:16:46 +0200 Subject: Require component for path append. Changed the signature of `path-append` to require at least one argument. The alternative would have been that no components expands into '.'. --- module/hnh/util/path.scm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'module/hnh/util/path.scm') diff --git a/module/hnh/util/path.scm b/module/hnh/util/path.scm index d22e8242..b92de8cd 100644 --- a/module/hnh/util/path.scm +++ b/module/hnh/util/path.scm @@ -18,7 +18,7 @@ ;; TODO remove intermidiate period components ;; e.x. /a/../b => /b -(define (path-append . strings) +(define (path-append path . paths) (fold (lambda (s done) (string-append done @@ -34,11 +34,9 @@ ;; the path absolute. This isn't exactly correct if we have ;; drive letters, but on those system the user should make ;; sure that the first component of the path is non-empty. - (let ((s (car strings))) - (if (string-null? s) - // s)) - (cdr strings) - )) + (if (string-null? path) + // path) + paths)) (define (path-join lst) (apply path-append lst)) -- cgit v1.2.3