summaryrefslogtreecommitdiff
path: root/haunt/utils.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-04-11 15:01:40 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-04-11 15:10:46 -0400
commit11a3e70657ffe2727ed0d1164e77c6c9b3420cf4 (patch)
treec593be84362a3bc4802519f007a59366d22b3d91 /haunt/utils.scm
parent7c7b161885c65d870be2aac680a2d4903d5c468a (diff)
site: Add build-site procedure.
* haunt/utils.scm (absolute-file-name, clean-directory): New procedures. * haunt/site.scm (build-site): New procedure.
Diffstat (limited to 'haunt/utils.scm')
-rw-r--r--haunt/utils.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/haunt/utils.scm b/haunt/utils.scm
index 504d6e2..8923e13 100644
--- a/haunt/utils.scm
+++ b/haunt/utils.scm
@@ -29,7 +29,9 @@
#:use-module (srfi srfi-26)
#:export (flatten
flat-map
- string-split-at))
+ string-split-at
+ absolute-file-name
+ clean-directory))
(define* (flatten lst #:optional depth)
"Return a list that recursively concatenates the sub-lists of LST,
@@ -56,3 +58,15 @@ flattened."
(string-drop str (1+ i)))
(list str))))
+(define (absolute-file-name file-name)
+ (if (absolute-file-name? file-name)
+ file-name
+ (string-append (getcwd) "/" file-name)))
+
+(define (clean-directory dir)
+ (define (delete-other-files file-name stat flag)
+ (unless (string=? dir file-name)
+ (delete-file file-name))
+ #t)
+
+ (ftw dir delete-other-files))