From d6f23fb60421c08e7bbd9c39d5be739da305e1b4 Mon Sep 17 00:00:00 2001 From: Mark <evenson.not.org@gmail.com> Date: Mon, 24 Apr 2017 09:16:48 +0200 Subject: [PATCH] Fix pathnames to use the asd defintion as the root --- main.lisp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/main.lisp b/main.lisp index 7879332..a41ffad 100644 --- a/main.lisp +++ b/main.lisp @@ -1,10 +1,11 @@ ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- (in-package :cl-site) +(require :asdf) ;; Locations for various files -(defparameter *PAGES-DIR* "content/") -(defparameter *LAYOUT-DIR* "layout/templates/") -(defparameter *OUTPUT-DIR* "output/") +(defparameter *PAGES-DIR* (asdf:system-relative-pathname :cl-site "content/")) +(defparameter *LAYOUT-DIR* (asdf:system-relative-pathname :cl-site "layout/templates/")) +(defparameter *OUTPUT-DIR* (asdf:system-relative-pathname :cl-site "output/")) (defparameter *PRIVATE-KEYS* '(:slug :content)) (defparameter *PAGES* @@ -18,8 +19,11 @@ (defun make-path (prefix page) - (pathname (concatenate 'string - prefix (cdr (assoc :content page))))) + (let ((path (cdr (assoc :content page)))) + (if (pathnamep prefix) + (merge-pathnames path prefix) + (pathname (concatenate 'string + prefix path))))) (defun file-to-string (filepath) (with-open-file (stream filepath) @@ -40,7 +44,6 @@ (mustache:render template-path page-context output-stream)))) (defun make-site () - (let - ((template-path (pathname (concatenate 'string *LAYOUT-DIR* *DEFAULT-PAGE-TEMPLATE*)))) - (loop for page in *PAGES* - do (render-page page template-path)))) + (let ((template-path (pathname (merge-pathnames *LAYOUT-DIR* *DEFAULT-PAGE-TEMPLATE*)))) + (loop for page in *PAGES* + do (render-page page template-path)))) -- GitLab