Sam Steingold writes:
> CMUCL does not allow me to create a wild pathname with MAKE-PATHNAME.
>
> Oh well...
Not without digging into the implementation, no. But as you
discovered, you can use lisp::make-pattern, and pass the resulting
object to MAKE-PATHNAME (you just got the syntax wrong at first). If
you're trying to port code, you could use something like this:
#+(or clisp lispworks)
(defun unix-wild (string) string)
#+cmu
(defun unix-wild (string)
(labels ((translate (pos acc)
(if (>= pos (length string)) acc
(let ((wild (position-if (lambda (c) (find c "*?"))
string :start pos)))
(if wild
(translate (1+ wild)
(list* (if (char= (char string wild) #\?)
:single-char-wild :multi-char-wild)
(subseq string pos wild)
acc))
(list* (subseq string pos) acc))))))
(lisp::make-pattern
(delete-if (lambda (x) (and (stringp x) (zerop (length x))))
(nreverse (translate 0 nil))))))
(make-pathname :name (unix-wild "foo-*-bar"))