diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-04-24 01:56:12 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-04-24 01:56:16 +0200 |
commit | b1a749ca8cf7dd1f49d8c79f7c65e0ec4e876747 (patch) | |
tree | 8542f9da8140975219010aa5309d88fabee62fe0 /module | |
parent | Dead code removal. (diff) | |
download | calp-b1a749ca8cf7dd1f49d8c79f7c65e0ec4e876747.tar.gz calp-b1a749ca8cf7dd1f49d8c79f7c65e0ec4e876747.tar.xz |
Introduce filename-extension procedure.
Diffstat (limited to '')
-rw-r--r-- | module/calp/entry-points/convert.scm | 3 | ||||
-rw-r--r-- | module/hnh/util/path.scm | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/module/calp/entry-points/convert.scm b/module/calp/entry-points/convert.scm index b1321f55..707414e5 100644 --- a/module/calp/entry-points/convert.scm +++ b/module/calp/entry-points/convert.scm @@ -2,6 +2,7 @@ :export (main) :use-module (hnh util) :use-module (hnh util options) + :use-module ((hnh util path) :select (filename-extension)) :use-module (ice-9 getopt-long) :use-module (sxml simple) :use-module (calp translation) @@ -20,7 +21,7 @@ (define (filename-to-type filename) - (let ((extension (car (reverse (string-split filename #\.))))) + (let ((extension (filename-extension filename))) (cond [(string-ci=? "ics" extension) "ical"] [(or (string-ci=? "xcal" extension) diff --git a/module/hnh/util/path.scm b/module/hnh/util/path.scm index 0aa747d0..49b53897 100644 --- a/module/hnh/util/path.scm +++ b/module/hnh/util/path.scm @@ -57,3 +57,6 @@ (define base (basename path)) (and (not (string-null? base)) (char=? #\. (string-ref base 0)))) + +(define-public (filename-extension filename) + (car (reverse (string-split filename #\.)))) |