On 5/1/06, 13 <one.three / gmail.com> wrote:
> Hi,
>
> Tempfile creates an empty file (in /tmp by default) even if I don't
> write in it. It's not very good IMO. I rather choose some self made
> random number based solution. It would be great if there were some
> Tempfile class method like Tempfile.name(basename, tmpdir=Dir::tmpdir)
> which returns just a name without creating a file.

It's creating the file immediately to prevent other processes or
threads from creating/accessing the same filename.  Depending on what
you're trying to do, that could be very handy.

> Thanks to all who helped !
>
> --
> Martins
>
> On 5/1/06, Robert Klemme <shortcutter / googlemail.com> wrote:
> > 2006/5/1, 13 <one.three / gmail.com>:
> > > Hi list,
> > >
> > > What is the best/easiest way to generate unique filenames ? Couln't
> > > find such method in Ruby :(
> >
> > You can use tempfile
> > http://ruby-doc.org/stdlib/libdoc/tempfile/rdoc/index.html
> >
> > Kind regards
> >
> > robert
> >
> > --
> > Have a look: http://www.flickr.com/photos/fussel-foto/
> >
> >
>
>


--
Bill Guindon (aka aGorilla)
The best answer to most questions is "it depends".