G M: 1. It changes the temp file handling to use the template and the current directory for windows, matching how it works on other platforms.
2. It re-enables the temp file handling for mingw that regressed. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192073 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e064055942
commit
ae2b90b86d
@ -42,19 +42,18 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||||
|
#include <io.h> // _mktemp
|
||||||
|
#endif
|
||||||
|
|
||||||
inline
|
inline
|
||||||
std::string
|
std::string
|
||||||
get_temp_file_name()
|
get_temp_file_name()
|
||||||
{
|
{
|
||||||
#ifdef _LIBCPP_MSVCRT
|
|
||||||
char* p = _tempnam( NULL, NULL );
|
|
||||||
if (p == nullptr)
|
|
||||||
abort();
|
|
||||||
std::string s(p);
|
|
||||||
free( p );
|
|
||||||
#else
|
|
||||||
std::string s("temp.XXXXXX");
|
std::string s("temp.XXXXXX");
|
||||||
|
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||||
|
_mktemp(&s[0]);
|
||||||
|
#else
|
||||||
mktemp(&s[0]);
|
mktemp(&s[0]);
|
||||||
#endif
|
#endif
|
||||||
return s;
|
return s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user