diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index 123f654..ee80d40 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -46,10 +46,11 @@ If RAW is non-nil, write the content without wrapping it in the base template." (curr (app-path ".curr"))) (ensure-directories-exist new-build) (run-program "mv ~a ~a" staging new-build) - ; KLUDGE: Is there a better way to portably catch dead symlinks? - (if (and (probe-file prev) (equal prev (ignore-errors (truename prev)))) - (delete-file prev) - (cl-fad:delete-directory-and-files (truename prev))) + (when (probe-file prev) + (let ((dest (truename prev))) + (if (equal prev dest) + (delete-file prev) + (cl-fad:delete-directory-and-files dest)))) (when (probe-file curr) (update-symlink prev (truename curr))) (update-symlink curr new-build)))))