From b4dac6b68433b3b6d07f389b8af8942c298644f8 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Tue, 3 Jun 2014 10:30:41 +0200 Subject: [PATCH] Fix archive filename matching, recent regression. The census test didn't pass anymore because I broke the archive filename matching in b17383fa90b81408fa08566bc131ea5b02606023, where the special variable *csv-path-root* stoped being authoritative in the archive case. To fix, initialize that variable to nil and give its value priority as soon as it's non-nil, such as the archive case. --- src/params.lisp | 4 ++-- src/sources/sources.lisp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/params.lisp b/src/params.lisp index 0c4726e..4e22798 100644 --- a/src/params.lisp +++ b/src/params.lisp @@ -57,8 +57,8 @@ (defparameter *state* nil "State of the current loading.") -(defparameter *csv-path-root* - (merge-pathnames "csv/" (user-homedir-pathname))) +(defparameter *csv-path-root* nil + "Where to load CSV files from, when loading from an archive.") (defparameter *root-dir* (make-pathname :directory "/tmp/pgloader/") diff --git a/src/sources/sources.lisp b/src/sources/sources.lisp index e8507a5..d1c3b83 100644 --- a/src/sources/sources.lisp +++ b/src/sources/sources.lisp @@ -189,7 +189,9 @@ (:inline (car part)) ; because of &rest (:stdin *standard-input*) (:regex (destructuring-bind (keep regex root) part - (filter-directory regex :keep keep :root root))) + (filter-directory regex + :keep keep + :root (or *csv-path-root* root)))) (:filename (let* ((filename (first part)) (realname (if (fad:pathname-absolute-p filename) filename