diff options
Diffstat (limited to 'module/hnh/util/path.scm')
-rw-r--r-- | module/hnh/util/path.scm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/module/hnh/util/path.scm b/module/hnh/util/path.scm index ac6df491..ea081e85 100644 --- a/module/hnh/util/path.scm +++ b/module/hnh/util/path.scm @@ -66,7 +66,13 @@ (char=? #\. (string-ref base 0)))) (define (filename-extension filename) - (car (reverse (string-split filename #\.)))) + (let ((components (-> filename + ;; Path split removes potential trailing directory separator + path-split last + basename + (string-split #\.)))) + (if (>= 1 (length components)) + "" (last components)))) (define (realpath filename) (unless (string? filename) |