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 8d35c09..f497037 100644 (file)
--- a/zone.lisp
+++ b/zone.lisp
   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
   "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)