aboutsummaryrefslogtreecommitdiff
path: root/src/data/files-tree.lisp
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-05-05 08:29:20 -0300
committerSean Whitton <spwhitton@spwhitton.name>2022-05-05 12:26:10 -0700
commit54d75297ea8b190a3b91bd662deb61e670e9f9ef (patch)
treecb0027e12ac3f8de9319ed98c80ea2d721f1f1d7 /src/data/files-tree.lisp
parentdd44f19023f4cc9a70b431aff999c9a771b364b1 (diff)
downloadconsfigurator-54d75297ea8b190a3b91bd662deb61e670e9f9ef.tar.gz
add package CONSFIGURATOR.DATA.UTIL
This package is intended to provide a home for utility functions used by multiple data sources. Initially move a local function from CONSFIGURATOR.DATA.FILES-TREE, and slightly generalize it to support an extension or TYPE argument. Note that the goal of LITERAL-DATA-PATHNAME is to map (IDEN1 IDEN2) to existing paths in a user-maintained file hierarchy. This is quite different from DATA-PATHNAME, which escapes various characters to map to a safe internal filename, effectively flattening a directory hierarchy into a single level. Signed-off-by: David Bremner <david@tethera.net>
Diffstat (limited to 'src/data/files-tree.lisp')
-rw-r--r--src/data/files-tree.lisp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/data/files-tree.lisp b/src/data/files-tree.lisp
index 993d9aa..8418a80 100644
--- a/src/data/files-tree.lisp
+++ b/src/data/files-tree.lisp
@@ -37,20 +37,12 @@ IDEN2 an an absolute or relative path are all supported."
(unless (directory-exists-p base-path)
(missing-data-source
"~A does not exist, or is not a directory." base-path))
- (labels ((%make-path (iden1 iden2)
- (merge-pathnames
- (uiop:relativize-pathname-directory
- iden2)
- (merge-pathnames
- (uiop:relativize-pathname-directory
- (ensure-directory-pathname iden1))
- base-path)))
- (check (iden1 iden2)
- (let ((file-path (%make-path iden1 iden2)))
+ (labels ((check (iden1 iden2)
+ (let ((file-path (literal-data-pathname base-path iden1 iden2)))
(and (file-exists-p file-path)
(file-write-date file-path))))
(extract (iden1 iden2)
- (let ((file-path (%make-path iden1 iden2)))
+ (let ((file-path (literal-data-pathname base-path iden1 iden2)))
(and (file-exists-p file-path)
(make-instance 'file-data
:file file-path