chiark / gitweb /
zone.lisp: Fix default output directory.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 15 Apr 2014 11:00:49 +0000 (12:00 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 15 Apr 2014 13:12:04 +0000 (14:12 +0100)
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

index 8d35c0976dff20284c3f8c86efbccc042e1b2be6..f497037c37745d8f08f01f1a7d810049a3f2848e 100644 (file)
--- 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)