}
shared_ptr<Film>
-new_test_film2 (string name)
+new_test_film2 (string name, Cleanup* cleanup)
{
auto p = test_film_dir (name);
if (boost::filesystem::exists (p)) {
boost::filesystem::remove_all (p);
}
+ if (cleanup) {
+ cleanup->add (p);
+ }
auto film = make_shared<Film>(p);
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
return s;
}
+
+void
+Cleanup::add (boost::filesystem::path path)
+{
+ _paths.push_back (path);
+}
+
+
+void
+Cleanup::run ()
+{
+ boost::system::error_code ec;
+ for (auto i: _paths) {
+ boost::filesystem::remove_all (i, ec);
+ }
+}