From 1d9e88f27a802939ac5c8674298bedb33c4eb38a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 9 Mar 2017 16:09:46 +0100 Subject: [PATCH] Fix createTempFile on Windows. --- appveyor.yml | 2 +- source/vibe/core/file.d | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ad5fa19..6de5d05 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -79,7 +79,7 @@ before_build: $env:Darch = "x86"; } elseif($env:arch -eq "x86_mscoff"){ - $env:compilersetupargs = "amd64"; + $env:compilersetupargs = "x86"; $env:Darch = "x86_mscoff"; } elseif($env:arch -eq "x64"){ diff --git a/source/vibe/core/file.d b/source/vibe/core/file.d index 9058d04..6b0cc99 100644 --- a/source/vibe/core/file.d +++ b/source/vibe/core/file.d @@ -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;