Ver código fonte

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

Howard Hinnant 12 anos atrás
pai
commit
ae2b90b86d
1 arquivos alterados com 6 adições e 7 exclusões
  1. 6 7
      test/support/platform_support.h

+ 6 - 7
test/support/platform_support.h

@@ -42,19 +42,18 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string>
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+#include <io.h> // _mktemp
+#endif
 
 inline
 std::string
 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");
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+   _mktemp(&s[0]);
+#else
    mktemp(&s[0]);
 #endif
    return s;