File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 2929
3030#include < unistd.h>
3131#include < cstdlib>
32+ #include < cstring>
3233
3334#include < iostream>
3435#include < vector>
@@ -45,6 +46,9 @@ class TempDir
4546 void clear ();
4647 std::vector <std::string> file_names () const ;
4748
49+ const std::string& name () const { return tmpName; };
50+ operator const std::string& () const { return name (); }
51+
4852private:
4953 std::string tmpName {};
5054 std::string oldDir {};
@@ -53,9 +57,11 @@ class TempDir
5357// //////////////////////////////////////////////////////////////////////////////
5458TempDir::TempDir ()
5559{
60+ char template_name[PATH_MAX] = {' \0 ' ,};
61+
5662 oldDir = Directory::cwd ();
5763
58- char template_name[] = " atomic_XXXXXX " ;
64+ strncpy ( template_name, (oldDir + " /timew_test_XXXXXX " ). c_str (), sizeof (template_name) - 1 ) ;
5965 const char *cwd = ::mkdtemp (template_name);
6066 if (cwd == nullptr )
6167 {
You can’t perform that action at this time.
0 commit comments