From 3d7852d98d9a540ce6b68a4ed26d170c78c7a2c7 Mon Sep 17 00:00:00 2001 Message-Id: <3d7852d98d9a540ce6b68a4ed26d170c78c7a2c7.1714059839.git.mdw@distorted.org.uk> From: Mark Wooding Date: Tue, 15 Apr 2014 12:00:49 +0100 Subject: [PATCH] zone.lisp: Fix default output directory. Organization: Straylight/Edgeware From: Mark Wooding The code used to capture `*default-pathname-defaults*' in `*zone-output-path*' at load time, which (varying by implementation) might indicate the calling process's working directory, or might be the directory from which the file was loaded. The latter is obviously wrong, so we adopt the convention in `zone-file-name' that if `*zone-output-path*' is nil then we use `*default-pathname-defaults' from the time of the call. --- zone.lisp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zone.lisp b/zone.lisp index 8d35c09..f497037 100644 --- a/zone.lisp +++ b/zone.lisp @@ -207,8 +207,12 @@ (defstruct (zone-subdomain (:conc-name zs-)) records) (export '*zone-output-path*) -(defvar *zone-output-path* *default-pathname-defaults* - "Pathname defaults to merge into output files.") +(defvar *zone-output-path* nil + "Pathname defaults to merge into output files. + + If this is nil then use the prevailing `*default-pathname-defaults*'. + This is not the same as capturing the `*default-pathname-defaults*' from + load time.") (export '*preferred-subnets*) (defvar *preferred-subnets* nil @@ -221,7 +225,7 @@ (defun zone-file-name (zone type) "Choose a file name for a given ZONE and TYPE." (merge-pathnames (make-pathname :name (string-downcase zone) :type (string-downcase type)) - *zone-output-path*)) + (or *zone-output-path* *default-pathname-defaults*))) (export 'zone-preferred-subnet-p) (defun zone-preferred-subnet-p (name) -- [mdw]