Browse Source

add remove-file-with-raw-path function in storage package.

This function is part of the 'reset website' feature implemention. You should
only need to call this when you want to delete something outsite of the /storage
directory (I.E. the website's database).
stable
Craig Oates 1 year ago
parent
commit
78298c08ee
  1. 15
      src/storage.lisp

15
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)
;;; =============================================================================

Loading…
Cancel
Save