Re: (DELETE-FILE open-file-stream)

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 08/10/04


Date: Mon, 09 Aug 2004 20:27:36 -0400

In article <u7js8kkig.fsf@gnu.org>, Sam Steingold <sds@gnu.org> wrote:

> > * Barry Margolin <onezne@nyhz.zvg.rqh> [2004-08-09 18:03:41 -0400]:
> >
> > In article <uhdrckp1f.fsf@gnu.org>, Sam Steingold <sds@gnu.org> wrote:
> >
> >> (setq stream (open "foo" :direction :output))
> >> (let ((*default-pathname-defaults* (make-pathname :type "tmp")))
> >> (delete-file stream))
> >> should delete "foo.tmp" and leave the STREAM and "foo" alone, right?
> >
> > I don't think so. If you use a stream as the argument, it operates on
> > the file that the stream is opened to. *DEFAULT-PATHNAME-DEFAULTS* is
> > not used at all in this case, since no filename parsing is being done.
>
> oops! thanks a lot!
>
> Now, how about
>
> (setq stream (open "foo" :direction :output))
>
> and
> (delete-file stream)
> vs
> (delete-file "foo")
> ???

The second will perform pathname defaulting, since that's part of
converting a string to a filename.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


Relevant Pages

  • Re: (DELETE-FILE open-file-stream)
    ... If you use a stream as the argument, ... > not used at all in this case, since no filename parsing is being done. ... Whether pronounced "leenooks" or "line-uks", it's better than Windows. ...
    (comp.lang.lisp)
  • Re: (DELETE-FILE open-file-stream)
    ... > argument stream should not be closed, ... > (delete-file stream)) ... *DEFAULT-PATHNAME-DEFAULTS* is ... not used at all in this case, since no filename parsing is being done. ...
    (comp.lang.lisp)