[armedbear-cvs] r13017 - trunk/abcl/src/org/armedbear/lisp

Mark Evenson mevenson at common-lisp.net
Wed Nov 10 22:23:06 UTC 2010


Author: mevenson
Date: Wed Nov 10 17:23:05 2010
New Revision: 13017

Log:
Check type in MAKE-PATHNAME for :DIRECTORY components.



Modified:
   trunk/abcl/src/org/armedbear/lisp/Pathname.java

Modified: trunk/abcl/src/org/armedbear/lisp/Pathname.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Pathname.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Pathname.java	Wed Nov 10 17:23:05 2010
@@ -1244,7 +1244,18 @@
                 } else if (value == Keyword.WILD) {
                     directory = list(Keyword.ABSOLUTE, Keyword.WILD);
                 } else {
-                    directory = value;
+                  // a valid pathname directory is a string, a list of strings, nil, :wild, :unspecific
+                  // ??? would be nice to (deftype pathname-arg ()
+                  // '(or (member :wild :unspecific) string (and cons ,(mapcar ...
+                  // Is this possible?
+                  if ((value instanceof Cons 
+                       // XXX check that the elements of a list are themselves valid
+                       || value == Keyword.UNSPECIFIC
+                       || value.equals(NIL))) {
+                      directory = value;
+                  } else {
+                      error(new TypeError("DIRECTORY argument not a string, list of strings, nil, :WILD, or :UNSPECIFIC.", value, NIL));
+                  }
                 }
             } else if (key == Keyword.NAME) {
                 name = value;




More information about the armedbear-cvs mailing list