From 791e5cf325da21fc544537fdab747050a17653a1 Mon Sep 17 00:00:00 2001 From: Brit Butler Date: Wed, 29 Aug 2012 00:54:54 -0400 Subject: [PATCH] Take extra care in handling PREV in case the symlink has gone bad. --- TODO | 4 ---- src/coleslaw.lisp | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index a8a0eb9..b16fd5d 100644 --- a/TODO +++ b/TODO @@ -2,10 +2,6 @@ What about themes? Templates are themes. DUH. Plugins? Injection support for HEAD and BODY. What about predicate-based injection? BUGS: -; Generated directories aren't being removed properly. -; Post-receive hook on server doesn't appear to be executing. Invoking manually behaves as expected. What's going on here? -;; Suspect these issues are related. read-symlink doesn't return a directory pathname which causes cl-fad:delete-directory-and-files to blowup. Maybe stop using iolib for symlinks? What is portable? -;;; Propose replacing iolib based symlink code with something that uses DIRECTORY and/or TRUENAME. ; Slugs aren't unicode safe. See [reddit discussion](http://www.reddit.com/r/lisp/comments/yvh6g/coleslaw_jekylllike_static_blogware_in_500_lines/) and [mozilla code](https://github.com/mozilla/unicode-slugify/blob/master/slugify/__init__.py). TODO: diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index 9899eea..5cda94f 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -52,8 +52,9 @@ If RAW is non-nil, write the content without wrapping it in the base template." (ensure-directories-exist new-build) (with-current-directory coleslaw-conf:*basedir* (run-program "mv" (mapcar #'namestring (list staging new-build))) - (when (probe-file prev) - (cl-fad:delete-directory-and-files (truename prev))) + (if (and (probe-file prev) (equal prev (truename prev))) + (delete-file prev) + (cl-fad:delete-directory-and-files (truename prev))) (when (probe-file curr) (update-symlink prev (truename curr))) (update-symlink curr new-build))))))