675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "test_common.h"
+
+#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
-#include "test_common.h"
+#include <sstream>
+
+using namespace std;
/**
* This allows tests to find the data files they require by looking
return Glib::getenv("PBD_TEST_PATH");
#endif
}
+
+std::string
+test_output_directory (std::string prefix)
+{
+ std::string tmp_dir = Glib::build_filename (g_get_tmp_dir(), "pbd_test");
+ std::string dir_name;
+ std::string new_test_dir;
+ do {
+ ostringstream oss;
+ oss << prefix;
+ oss << g_random_int ();
+ dir_name = oss.str();
+ new_test_dir = Glib::build_filename (tmp_dir, dir_name);
+ if (Glib::file_test (new_test_dir, Glib::FILE_TEST_EXISTS)) continue;
+ } while (g_mkdir_with_parents (new_test_dir.c_str(), 0755) != 0);
+ return new_test_dir;
+}