[osicat-cvs] CVS update: src/osicat.lisp src/packages.lisp

Nikodemus Siivola nsiivola at common-lisp.net
Mon Mar 8 06:41:32 UTC 2004


Update of /project/osicat/cvsroot/src
In directory common-lisp.net:/tmp/cvs-serv19603

Modified Files:
	osicat.lisp packages.lisp 
Log Message:
Shadow directory
Date: Mon Mar  8 01:41:32 2004
Author: nsiivola

Index: src/osicat.lisp
diff -u src/osicat.lisp:1.16 src/osicat.lisp:1.17
--- src/osicat.lisp:1.16	Sun Feb 29 18:41:50 2004
+++ src/osicat.lisp	Mon Mar  8 01:41:32 2004
@@ -71,17 +71,25 @@
 (defun relative-pathname-p (pathspec)
   (not (eq :absolute (car (pathname-directory pathspec)))))
 
-(defun absolute-pathname 
-    (pathspec &optional (default *default-pathname-defaults*))
-    (if (relative-pathname-p pathspec)
-	(let ((tmp (merge-pathnames 
-		    pathspec
-		    (make-pathname :name nil :type nil :version nil
-				   :defaults default))))
-	  (if (relative-pathname-p tmp)
-	      (merge-pathnames tmp (current-directory))
-	      tmp))
-	pathspec))
+(defun absolute-pathname (pathspec &optional (default *default-pathname-defaults*))
+  (if (relative-pathname-p pathspec)
+      (let ((tmp (merge-pathnames 
+		  pathspec
+		  (make-pathname :name nil :type nil :version nil
+				 :defaults default))))
+	(if (relative-pathname-p tmp)
+	    (merge-pathnames tmp (current-directory))
+	    tmp))
+      pathspec))
+
+(defun escape-wild-name (name)
+  (declare (simple-string name))
+  (let (stack)
+    (loop for char across name
+	  when (member char '(#\* #\[))
+	  do (push #\\ stack)
+	  do (push char stack))
+    (coerce (nreverse stack) 'simple-string)))
 
 (defun unmerge-pathnames
     (pathspec &optional (known *default-pathname-defaults*))
@@ -107,8 +115,6 @@
 		 dir
 		 (cons :relative dir)))))
     (let ((path (absolute-pathname pathspec)))
-      (when (wild-pathname-p path)
-	(error "Pathname is wild: ~S." path))
       (with-cstring (cfile (namestring path))
 	(let ((abspath (if (eq :directory (c-file-kind cfile t))
 			   (make-pathname :name nil :type nil
@@ -170,13 +176,13 @@
 			   (let ((entry (readdir ,dp)))
 			     (if (null-pointer-p entry)
 				 nil
-				 (let ((name 
+				 (let ((string
 					(convert-from-cstring
 					 (osicat-dirent-name entry))))
-				   (if (member name '("." "..") 
+				   (if (member string '("." "..") 
 					       :test #'string=)
 				       (,one-iter)
-				       (normpath name)))))))
+				       (normpath (escape-wild-name string))))))))
 		  (macrolet ((,iterator () 
 			       `(,',one-iter)))
 		    (setf ,dp (opendir ,cdir))


Index: src/packages.lisp
diff -u src/packages.lisp:1.6 src/packages.lisp:1.7
--- src/packages.lisp:1.6	Sun Feb 29 18:43:09 2004
+++ src/packages.lisp	Mon Mar  8 01:41:32 2004
@@ -35,6 +35,9 @@
   When a relative pathname designator is used as a directory designator
   it is first resolved agains *default-pathname-default*, and then
   against the current directory. (With MERGE-PATHNAMES in both cases.)")
+  (:shadow
+   ;; DIRECTORY is used as constant internally. Let's not confuse other packages.
+   #:directory)
   (:export
    ;;; Evironment
    #:environment   





More information about the Osicat-cvs mailing list