Commit 05dc4263 authored by Dave Cooper's avatar Dave Cooper

Remove destination static file, if it exists, before copying

Because on some implementations, uiop:copy-file will not overwrite
existing files, we explicitly remove existing destination files before
copying with uiop:copy-file.
parent 9f73f074
......@@ -10,5 +10,8 @@ output/
system-index.txt
content/newsbox.html
content/about.html
content/libraries.html
content/lisp-companies.html
content/news.html
*.dx64fsl
*.fasl
\ No newline at end of file
(in-package :cl-user)
(push (make-pathname :defaults *load-truename* :name nil :type nil)
quicklisp:*local-project-directories*)
(pushnew (make-pathname :defaults *load-truename* :name nil :type nil)
quicklisp:*local-project-directories* :test #'equalp)
(ql:register-local-projects)
......
......@@ -13,7 +13,8 @@
:pathname ""
:serial t
:depends-on (package)
:components ((:file "globals")
:components ((:file "patches")
(:file "globals")
(:file "helpers")
(:file "process")
(:file "main")))
......
......@@ -19,14 +19,16 @@
;; Copies/renders static assets (imgs, etc)
(defun process-static (static-dir output-dir)
(let ((destination-root (merge-pathnames #P"static/" output-dir))
(sources (directory (merge-pathnames "**/*.*" static-dir)))
(sources (remove-if #'uiop/filesystem:directory-exists-p
(directory (merge-pathnames "**/*.*" static-dir))))
static-list)
(dolist (source sources)
(let* ((relative-path (enough-namestring source static-dir))
(destination (merge-pathnames relative-path destination-root)))
(when (pathname-name destination) ;; ignore directories
(ensure-directories-exist destination)
;(format t "~a -> ~a~%" source destination)
;;(format t "~a -> ~a~%" source destination)
(when (probe-file destination) (delete-file destination))
(uiop:copy-file source destination)
(push (cons :location relative-path) static-list))))
(push (cons :static (nreverse static-list))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment