aboutsummaryrefslogtreecommitdiff
path: root/src/data.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-23 10:49:32 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-23 12:11:08 -0700
commit3ded795001c26507dc2954a2aa1e9f4acab730c5 (patch)
treefa8da71ed488bef325425ca525a55545177e58c0 /src/data.lisp
parent2b18eb68088715541e217e112871c14316403981 (diff)
downloadconsfigurator-3ded795001c26507dc2954a2aa1e9f4acab730c5.tar.gz
add ENSURE-DIRECTORIES-EXIST to LOCAL-DATA-PATHNAME and export
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/data.lisp')
-rw-r--r--src/data.lisp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/data.lisp b/src/data.lisp
index 20d27e3..7f31b21 100644
--- a/src/data.lisp
+++ b/src/data.lisp
@@ -260,8 +260,19 @@ clashes. It should not be called by properties."
(mapcar (lambda (s) (strcat s "/")) rest)
:from-end t :initial-value root))))
-(defun local-data-pathname (&rest args)
- (apply #'data-pathname (get-local-data-cache-dir) args))
+(defun local-data-pathname (&optional iden1 iden2 version)
+ "Get a pathname where an item of prerequisite data may be cached, ensuring
+that parent directories exist.
+This is exported for use by prerequisite data sources which work by generating
+new files and need somewhere to store them. It should not be used by
+properties, or data sources which return objects referencing existing files.
+
+Note that since prerequisite data sources are queried only in the root Lisp,
+but items of prerequisite data are never uploaded to the root Lisp, there is
+no risk of clashes between fresly generated files and cached copies of files."
+ (ensure-directories-exist
+ (apply #'data-pathname (get-local-data-cache-dir)
+ (delete-if #'null (list iden1 iden2 version)))))
(defun remote-data-pathname (&rest args)
(apply #'data-pathname (get-remote-data-cache-dir) args))