13 #ifndef __STOUT_OS_WINDOWS_MKTEMP_HPP__ 14 #define __STOUT_OS_WINDOWS_MKTEMP_HPP__ 43 std::vector<wchar_t> buffer(longpath.begin(), longpath.end());
47 buffer.push_back(L
'\0');
54 if (::_wmktemp_s(buffer.data(), buffer.size()) != 0) {
58 const std::string temp_file =
stringify(std::wstring(buffer.data()));
65 os::open(temp_file, O_RDWR | O_CREAT | O_EXCL, _S_IREAD | _S_IWRITE);
80 #endif // __STOUT_OS_WINDOWS_MKTEMP_HPP__
Definition: errorbase.hpp:36
T & get()&
Definition: try.hpp:80
Try< std::string > mktemp(const std::string &path=path::join(os::temp(),"XXXXXX"))
Definition: mktemp.hpp:36
Try< int_fd > open(const std::string &path, int oflag, mode_t mode=0)
Definition: open.hpp:35
Definition: error.hpp:108
Definition: posix_signalhandler.hpp:23
std::string join(const std::string &path1, const std::string &path2, const char _separator=os::PATH_SEPARATOR)
Definition: path.hpp:116
std::string remove(const std::string &from, const std::string &substring, Mode mode=ANY)
Definition: strings.hpp:41
Try< Nothing > close(int fd)
Definition: close.hpp:24
static Try error(const E &e)
Definition: try.hpp:43
bool isError() const
Definition: try.hpp:78
std::string temp()
Definition: temp.hpp:27
std::wstring longpath(const std::string &path)
Definition: longpath.hpp:38
std::string stringify(int flags)