libcxx: Provide overloads for basic_filebuf::open() et al that take wchar_t* filenames on Windows.
This is an MSVC standard library extension. It seems like a reasonable enough extension to me because wchar_t* is the native format for filenames on that platform. Differential Revision: https://reviews.llvm.org/D42225 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323170 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -54,6 +54,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
#if defined(_WIN32) || defined(__MINGW32__)
|
||||
#include <io.h> // _mktemp_s
|
||||
@@ -97,6 +99,16 @@ std::string get_temp_file_name()
|
||||
return Name;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
inline
|
||||
std::wstring get_wide_temp_file_name()
|
||||
{
|
||||
return std::wstring_convert<std::codecvt_utf8_utf16<wchar_t> >().from_bytes(
|
||||
get_temp_file_name());
|
||||
}
|
||||
#endif // _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
|
||||
#endif // __CloudABI__
|
||||
|
||||
#endif // PLATFORM_SUPPORT_H
|
||||
|
||||
Reference in New Issue
Block a user