diff --git a/src/storage.lisp b/src/storage.lisp index 8d661ba..980d08a 100644 --- a/src/storage.lisp +++ b/src/storage.lisp @@ -20,7 +20,8 @@ #:store-with-raw-path #:store-text-with-raw-path #:open-text-file-with-raw-path - #:store-test)) + #:store-test + #:remove-file-with-raw-path)) (in-package #:storage) (defun init-storage () @@ -42,10 +43,11 @@ This is used as part of the /run-set defroute in web.lisp file." (uiop:copy-file (make-path "" "default-assets" "favicon.png") (merge-pathnames "static/images/favicon.png" ritherdon-archive.config:*application-root*)) - (ensure-directory-exists "" "snippets") (uiop:copy-file (make-path "" "default-assets" "site-wide-snippet.html") - (make-path "" "snippets" "site-wide-snippet.html"))) + (make-path "" "snippets" "site-wide-snippet.html")) + ;; Nothing is added to /storage/media yet, this is just prep. work. + (ensure-directory-exists "" "media")) (defun directory-exists-p (username directory) "Checks to see if the specified diretory exists. @@ -228,6 +230,13 @@ Use when reading text outside the /storage directory." (read-sequence data stream) data)))) + +(defun remove-file-with-raw-path (file-path) + "Deletes the specified file, at `PATH', use this to delete file outsite of /storage. +Before calling this function, make sure the file exists. You should have +'file-exists-p' available to you -- within this (storage) package." + (delete-file (merge-pathnames file-path ritherdon-archive.config::*application-root*))) + ;;; PORTED FROM RAILS-TO-CAVEMAN PROJECT (expect it to be deleted) ;;; =============================================================================