}
/** Given a directory name, return its full path within the Film's directory.
- * The directory (and its parents) will be created if they do not exist.
+ * @param d directory name within the Filn's directory.
+ * @param create true to create the directory (and its parents) if they do not exist.
*/
boost::filesystem::path
-Film::dir (boost::filesystem::path d) const
+Film::dir (boost::filesystem::path d, bool create) const
{
DCPOMATIC_ASSERT (_directory);
p /= _directory.get();
p /= d;
- boost::filesystem::create_directories (p);
+ if (create) {
+ boost::filesystem::create_directories (p);
+ }
return p;
}
}
boost::filesystem::path file (boost::filesystem::path f) const;
- boost::filesystem::path dir (boost::filesystem::path d) const;
+ boost::filesystem::path dir (boost::filesystem::path d, bool create = true) const;
void use_template (std::string name);
std::list<std::string> read_metadata (boost::optional<boost::filesystem::path> path = boost::optional<boost::filesystem::path> ());
, _repeat_written (0)
, _pushed_to_disk (0)
{
- /* Remove any old DCP */
- boost::filesystem::remove_all (_film->dir (_film->dcp_name ()));
-
shared_ptr<Job> job = _job.lock ();
DCPOMATIC_ASSERT (job);
}
}
+
+ /* Remove any existing DCP if the user agrees */
+ boost::filesystem::path const dcp_dir = _film->dir (_film->dcp_name(), false);
+ if (boost::filesystem::exists (dcp_dir)) {
+ if (!confirm_dialog (this, wxString::Format (_("Do you want to overwrite the existing DCP %s?"), std_to_wx(dcp_dir.string()).data()))) {
+ return;
+ }
+ boost::filesystem::remove_all (dcp_dir);
+ }
+
try {
/* It seems to make sense to auto-save metadata here, since the make DCP may last
a long time, and crashes/power failures are moderately likely.