diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-23 03:23:44 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-23 03:48:22 +0200 |
commit | 1976980d4a272fb7fc3694c734bfc6825edfc721 (patch) | |
tree | 8460db1176c64895e9968447588953fac85fe7d6 /module/hnh/util/path.scm | |
parent | Remove all inline use-modules. (diff) | |
download | calp-1976980d4a272fb7fc3694c734bfc6825edfc721.tar.gz calp-1976980d4a272fb7fc3694c734bfc6825edfc721.tar.xz |
Centralize (almost) all exports to :export in define-module.
Diffstat (limited to '')
-rw-r--r-- | module/hnh/util/path.scm | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/module/hnh/util/path.scm b/module/hnh/util/path.scm index 340c2d8b..ac6df491 100644 --- a/module/hnh/util/path.scm +++ b/module/hnh/util/path.scm @@ -1,12 +1,18 @@ (define-module (hnh util path) :use-module (srfi srfi-1) :use-module (srfi srfi-71) - :use-module (hnh util)) + :use-module (hnh util) + :export (path-append + path-join + path-split + file-hidden? + filename-extension + realpath)) (define // file-name-separator-string) (define /? file-name-separator?) -(define-public (path-append . strings) +(define (path-append . strings) (fold (lambda (s done) (string-append done @@ -28,7 +34,7 @@ (cdr strings) )) -(define-public (path-join lst) (apply path-append lst)) +(define (path-join lst) (apply path-append lst)) ;; @example ;; (path-split "usr/lib/test") @@ -40,7 +46,7 @@ ;; (path-split "//usr////lib/test") ;; ⇒ ("" "usr" "lib" "test") ;; @end example -(define-public (path-split path) +(define (path-split path) (let ((head tail (car+cdr (reverse @@ -54,16 +60,15 @@ (cons head (remove string-null? tail)))) -(define-public (file-hidden? path) +(define (file-hidden? path) (define base (basename path)) (and (not (string-null? base)) (char=? #\. (string-ref base 0)))) -(define-public (filename-extension filename) +(define (filename-extension filename) (car (reverse (string-split filename #\.)))) - -(define-public (realpath filename) +(define (realpath filename) (unless (string? filename) (scm-error 'wrong-type-arg "realpath" "filename not a string: ~a" |