Use PBD::tmp_writable_directory in test_output_directory
This commit is contained in:
parent
1abe8f4e42
commit
1c1eff8845
@ -21,6 +21,8 @@
|
|||||||
#include <glibmm/fileutils.h>
|
#include <glibmm/fileutils.h>
|
||||||
#include <glibmm/miscutils.h>
|
#include <glibmm/miscutils.h>
|
||||||
|
|
||||||
|
#include "pbd/file_utils.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -44,18 +46,7 @@ test_search_path ()
|
|||||||
std::string
|
std::string
|
||||||
test_output_directory (std::string prefix)
|
test_output_directory (std::string prefix)
|
||||||
{
|
{
|
||||||
std::string tmp_dir = Glib::build_filename (g_get_tmp_dir(), "pbd_test");
|
return PBD::tmp_writable_directory (PACKAGE, prefix);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -173,6 +173,7 @@ def build(bld):
|
|||||||
testobj.uselib = 'CPPUNIT XML SNDFILE'
|
testobj.uselib = 'CPPUNIT XML SNDFILE'
|
||||||
testobj.use = 'libpbd'
|
testobj.use = 'libpbd'
|
||||||
testobj.name = 'libpbd-tests'
|
testobj.name = 'libpbd-tests'
|
||||||
|
testobj.defines = [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
|
||||||
if sys.platform != 'darwin' and bld.env['build_target'] != 'mingw':
|
if sys.platform != 'darwin' and bld.env['build_target'] != 'mingw':
|
||||||
testobj.linkflags = ['-lrt']
|
testobj.linkflags = ['-lrt']
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user