Duck util-dir module.

This commit is contained in:
Dominik Pantůček 2023-07-07 14:33:35 +02:00
parent 1eced966bf
commit 1b18c99d3c
4 changed files with 24 additions and 5 deletions

View file

@ -25,8 +25,11 @@
(declare (unit util-dir))
(module
(import duck)
(module*
util-dir
#:doc ("Directory handling which didn't fit elsewhere.")
(
ensure-directory
)
@ -36,7 +39,9 @@
(chicken file)
(chicken file posix))
(define (ensure-directory dir)
(define/doc (ensure-directory dir)
("Makes sure given path exists and it is a directory. Throws an error
if it exists and it is not a directory.")
(when (and (file-exists? dir)
(regular-file? dir))
(error 'gen-web-static "Directory is a file:" dir))