Fix utDefaultIOStream test under MinGW (#5525)

pull/5518/head^2
Oleg Ivanov 2024-04-06 12:48:28 +02:00 committed by GitHub
parent 39ce0c0456
commit 9d11b220eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -44,9 +44,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cstdlib> #include <cstdlib>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__)
#define TMP_PATH "./"
#elif defined(__GNUC__) || defined(__clang__)
#define TMP_PATH "/tmp/"
#endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
#include <io.h> #include <io.h>
#define TMP_PATH "./"
inline FILE* MakeTmpFile(char* tmplate) inline FILE* MakeTmpFile(char* tmplate)
{ {
auto pathtemplate = _mktemp(tmplate); auto pathtemplate = _mktemp(tmplate);
@ -60,7 +65,6 @@ inline FILE* MakeTmpFile(char* tmplate)
return fs; return fs;
} }
#elif defined(__GNUC__) || defined(__clang__) #elif defined(__GNUC__) || defined(__clang__)
#define TMP_PATH "/tmp/"
inline FILE* MakeTmpFile(char* tmplate) inline FILE* MakeTmpFile(char* tmplate)
{ {
auto fd = mkstemp(tmplate); auto fd = mkstemp(tmplate);