Fix createTempFile on Windows.

This commit is contained in:
Sönke Ludwig 2017-03-09 16:09:46 +01:00
parent 9e492ab4f1
commit 1d9e88f27a
2 changed files with 4 additions and 4 deletions

View file

@ -144,9 +144,9 @@ FileStream createTempFile(string suffix = null)
import std.conv : to;
string tmpname;
() @trusted {
char[L_tmpnam] tmp;
tmpnam(tmp.ptr);
tmpname = to!string(tmp.ptr);
auto fn = tmpnam(null);
enforce(fn !is null, "Failed to generate temporary name.");
tmpname = to!string(fn);
} ();
if (tmpname.startsWith("\\")) tmpname = tmpname[1 .. $];
tmpname ~= suffix;