[Issue 13996] Function for returning a temporary file with a randomly generated name where the name can be accessed

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Feb 3 16:06:10 PST 2015


https://issues.dlang.org/show_bug.cgi?id=13996

Martin Nowak <code at dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code at dawg.eu

--- Comment #1 from Martin Nowak <code at dawg.eu> ---
You forgot suffix argument :).

It's missing for ages, we just needed it for dub
https://github.com/D-Programming-Language/dub/pull/497#issuecomment-72763326.

The python implementation takes a reasonable approach, generate random names
and try to exclusively open the file.

https://github.com/python/cpython/blob/1196330dedbe741f8a0c418abcd2956fad29837f/Lib/tempfile.py#L191

The new function could be called namedTempFile. It's still useful to have a
tempFile function that directly unlink the file.

--


More information about the Digitalmars-d-bugs mailing list