12 #include <util/pragma_push.def> 14 #pragma warning(disable:4668) 20 #include <util/pragma_pop.def> 26 #if defined(__linux__) || \ 27 defined(__FreeBSD_kernel__) || \ 29 defined(__unix__) || \ 30 defined(__CYGWIN__) || \ 44 DWORD dwBufSize = MAX_PATH + 1;
45 char lpPathBuffer[MAX_PATH + 1];
46 DWORD dwRetVal = GetTempPathA(dwBufSize, lpPathBuffer);
48 if(dwRetVal > dwBufSize || (dwRetVal == 0))
58 UINT uRetVal = GetTempFileNameA(lpPathBuffer,
"TLO", 0, t);
62 std::string(
"Couldn't get new temporary file name in directory") +
70 std::string(
"Couldn't create temporary directory at ") + t);
72 result = std::string(t);
75 std::string prefixed_name_template =
"/tmp/";
76 const char *TMPDIR_env = getenv(
"TMPDIR");
77 if(TMPDIR_env !=
nullptr)
78 prefixed_name_template = TMPDIR_env;
79 if(*prefixed_name_template.rbegin() !=
'/')
80 prefixed_name_template +=
'/';
81 prefixed_name_template += name_template;
84 prefixed_name_template.begin(), prefixed_name_template.end());
86 const char *td = mkdtemp(t.data());
89 result = std::string(td);
std::string concat_dir_file(const std::string &directory, const std::string &file_name)
temp_dirt(const std::string &name_template)
std::string operator()(const std::string &file)
void delete_directory(const std::string &path)
deletes all files in 'path' and then the directory itself
Thrown when some external system fails unexpectedly.
std::string get_temporary_directory(const std::string &name_template)