Skip to content
Snippets Groups Projects
Commit 25fc2380 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Fix issues with 3.1.4.2: restore (when string ...) in parse-native-namestring;

actually enforce empty-is-nil in getenv-pathnames. Reindenting a few forms.
parent 51dd481a
No related branches found
No related tags found
No related merge requests found
...@@ -45,13 +45,14 @@ ...@@ -45,13 +45,14 @@
a CL pathname satisfying all the specified constraints as per ENSURE-PATHNAME" a CL pathname satisfying all the specified constraints as per ENSURE-PATHNAME"
(check-type string (or string null)) (check-type string (or string null))
(let* ((pathname (let* ((pathname
(with-pathname-defaults () (when string
#+clozure (ccl:native-to-pathname string) (with-pathname-defaults ()
#+sbcl (sb-ext:parse-native-namestring string) #+clozure (ccl:native-to-pathname string)
#-(or clozure sbcl) #+sbcl (sb-ext:parse-native-namestring string)
(if (os-unix-p) #-(or clozure sbcl)
(parse-unix-namestring string :ensure-directory ensure-directory) (if (os-unix-p)
(parse-namestring string)))) (parse-unix-namestring string :ensure-directory ensure-directory)
(parse-namestring string)))))
(pathname (pathname
(if ensure-directory (if ensure-directory
(and pathname (ensure-directory-pathname pathname)) (and pathname (ensure-directory-pathname pathname))
...@@ -502,11 +503,11 @@ Note that this operation is usually NOT thread-safe." ...@@ -502,11 +503,11 @@ Note that this operation is usually NOT thread-safe."
"What character does the current OS conventionally uses to separate directories?" "What character does the current OS conventionally uses to separate directories?"
(if (os-unix-p) #\: #\;)) (if (os-unix-p) #\: #\;))
(defun split-native-pathnames-string (string &rest constraints &key &allow-other-keys) (defun split-native-pathnames-string (string &rest constraints &key &allow-other-keys)
"Given a string of pathnames specified in native OS syntax, separate them in a list, "Given a string of pathnames specified in native OS syntax, separate them in a list,
check constraints and normalize each one as per ENSURE-PATHNAME, check constraints and normalize each one as per ENSURE-PATHNAME,
where an empty string denotes NIL." where an empty string denotes NIL."
(loop :for namestring :in (split-string string :separator (string (inter-directory-separator))) (loop :for namestring :in (split-string string :separator (string (inter-directory-separator)))
:collect (unless (emptyp namestring) (apply 'parse-native-namestring namestring constraints)))) :collect (unless (emptyp namestring) (apply 'parse-native-namestring namestring constraints))))
(defun getenv-pathname (x &rest constraints &key ensure-directory want-directory on-error &allow-other-keys) (defun getenv-pathname (x &rest constraints &key ensure-directory want-directory on-error &allow-other-keys)
...@@ -527,6 +528,7 @@ check constraints and normalize each one as per ENSURE-PATHNAME. ...@@ -527,6 +528,7 @@ check constraints and normalize each one as per ENSURE-PATHNAME.
(apply 'split-native-pathnames-string (getenvp x) (apply 'split-native-pathnames-string (getenvp x)
:on-error (or on-error :on-error (or on-error
`(error "In (~S ~S), invalid pathname ~*~S: ~*~?" getenv-pathnames ,x)) `(error "In (~S ~S), invalid pathname ~*~S: ~*~?" getenv-pathnames ,x))
:empty-is-nil t
constraints)) constraints))
(defun getenv-absolute-directory (x) (defun getenv-absolute-directory (x)
"Extract an absolute directory pathname from a user-configured environment variable, "Extract an absolute directory pathname from a user-configured environment variable,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment