summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haunt/serve/mime-types.scm6
-rw-r--r--haunt/utils.scm6
2 files changed, 7 insertions, 5 deletions
diff --git a/haunt/serve/mime-types.scm b/haunt/serve/mime-types.scm
index 67489b5..7b521c0 100644
--- a/haunt/serve/mime-types.scm
+++ b/haunt/serve/mime-types.scm
@@ -23,6 +23,7 @@
;;; Code:
(define-module (haunt serve mime-types)
+ #:use-module (haunt utils)
#:use-module (ice-9 hash-table)
#:use-module (ice-9 regex)
#:export (mime-type))
@@ -540,11 +541,6 @@
("vrml" . x-world/x-vrml)
("wrl" . x-world/x-vrml))))
-(define (file-extension file)
- "Return the extension of FILE or #f if there is none."
- (let ((dot (string-rindex file #\.)))
- (and dot (substring file (+ 1 dot) (string-length file)))))
-
(define (mime-type file-name)
"Guess the MIME type for FILE-NAME based upon its file extension."
(or (hash-ref %mime-types (file-extension file-name))
diff --git a/haunt/utils.scm b/haunt/utils.scm
index fb4d170..230e4da 100644
--- a/haunt/utils.scm
+++ b/haunt/utils.scm
@@ -35,6 +35,7 @@
file-name-components
join-file-name-components
absolute-file-name
+ file-extension
delete-file-recursively
mkdir-p
string->date*
@@ -95,6 +96,11 @@ as-is."
file-name
(string-append (getcwd) "/" file-name)))
+(define (file-extension file)
+ "Return the extension of FILE or #f if there is none."
+ (let ((dot (string-rindex file #\.)))
+ (and dot (substring file (+ 1 dot) (string-length file)))))
+
;; Written by Ludovic Courtès for GNU Guix.
(define* (delete-file-recursively dir
#:key follow-mounts?)