Fix safety error on Windows.
This commit is contained in:
parent
a7bfbc1c45
commit
79656a80df
|
@ -142,10 +142,13 @@ FileStream createTempFile(string suffix = null)
|
||||||
{
|
{
|
||||||
version(Windows){
|
version(Windows){
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
|
string tmpname;
|
||||||
|
() @trusted {
|
||||||
char[L_tmpnam] tmp;
|
char[L_tmpnam] tmp;
|
||||||
tmpnam(tmp.ptr);
|
tmpnam(tmp.ptr);
|
||||||
auto tmpname = to!string(tmp.ptr);
|
tmpname = to!string(tmp.ptr);
|
||||||
if( tmpname.startsWith("\\") ) tmpname = tmpname[1 .. $];
|
} ();
|
||||||
|
if (tmpname.startsWith("\\")) tmpname = tmpname[1 .. $];
|
||||||
tmpname ~= suffix;
|
tmpname ~= suffix;
|
||||||
return openFile(tmpname, FileMode.createTrunc);
|
return openFile(tmpname, FileMode.createTrunc);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -194,7 +194,7 @@ NetworkAddress anyAddress()
|
||||||
struct NetworkAddress {
|
struct NetworkAddress {
|
||||||
import std.socket : Address;
|
import std.socket : Address;
|
||||||
|
|
||||||
version (Windows) import std.c.windows.winsock;
|
version (Windows) import core.sys.windows.winsock2;
|
||||||
else import core.sys.posix.netinet.in_;
|
else import core.sys.posix.netinet.in_;
|
||||||
|
|
||||||
@safe:
|
@safe:
|
||||||
|
|
Loading…
Reference in a new issue