21 #if defined(__linux__) || \ 22 defined(__FreeBSD_kernel__) || \ 24 defined(__unix__) || \ 25 defined(__CYGWIN__) || \ 37 DWORD dwBufSize = MAX_PATH;
38 char lpPathBuffer[MAX_PATH];
39 DWORD dwRetVal = GetTempPathA(dwBufSize, lpPathBuffer);
41 if(dwRetVal > dwBufSize || (dwRetVal == 0))
42 throw "GetTempPath failed";
46 strncpy(t, name_template.c_str(), MAX_PATH);
48 UINT uRetVal=GetTempFileNameA(lpPathBuffer,
"TLO", 0, t);
50 throw "GetTempFileName failed";
54 throw "_mkdir failed";
56 result=std::string(t);
59 std::string prefixed_name_template=
"/tmp/";
60 const char *TMPDIR_env=getenv(
"TMPDIR");
61 if(TMPDIR_env!=
nullptr)
62 prefixed_name_template=TMPDIR_env;
63 if(*prefixed_name_template.rbegin()!=
'/')
64 prefixed_name_template+=
'/';
65 prefixed_name_template+=name_template;
68 strncpy(t, prefixed_name_template.c_str(), 1000);
69 const char *td = mkdtemp(t);
71 throw "mkdtemp failed";
72 result=std::string(td);
102 if(chdir(
path.c_str())!=0)
std::string concat_dir_file(const std::string &directory, const std::string &file_name)
std::string get_current_working_directory()
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
temp_working_dirt(const std::string &name_template)
std::string old_working_directory
std::string get_temporary_directory(const std::string &name_template)