summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-05-07 00:27:11 +0100
committerCarl Hetherington <cth@carlh.net>2015-05-07 00:27:11 +0100
commit7af8a1943d88e14ed26302bc0f954c90bd358e46 (patch)
tree22416e6eefe045be131ba11e788a63808927152c /src
parent3d477152e7991b8a5470bf157bc5c79001ba23b2 (diff)
Write subtitle stuff to a subdirectory based on ID.
Diffstat (limited to 'src')
-rw-r--r--src/lib/writer.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index d2116362e..31c265e2f 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -512,18 +512,24 @@ Writer::finish ()
boost::filesystem::path const from = i->file.get_value_or (liberation);
_subtitle_content->add_font (i->id, from.leaf().string ());
- boost::filesystem::path to = _film->dir (_film->dcp_name ()) / from.leaf();
+ boost::filesystem::path to = _film->dir (_film->dcp_name ()) / _subtitle_content->id ();
+ boost::filesystem::create_directories (to, ec);
+ if (ec) {
+ throw FileError (_("Could not create directory"), to);
+ }
+
+ to /= from.leaf();
boost::system::error_code ec;
boost::filesystem::copy_file (from, to, ec);
- if (!ec) {
- dcp.add (shared_ptr<dcp::Font> (new dcp::Font (to)));
- } else {
- LOG_WARNING_NC (String::compose ("Could not copy font %1 to DCP", from.string ()));
+ if (ec) {
+ throw FileError ("Could not copy font to DCP", from);
}
+
+ dcp.add (shared_ptr<dcp::Font> (new dcp::Font (to)));
}
- _subtitle_content->write_xml (_film->dir (_film->dcp_name ()) / _film->subtitle_xml_filename ());
+ _subtitle_content->write_xml (_film->dir (_film->dcp_name ()) / _subtitle_content->id () / _film->subtitle_xml_filename ());
reel->add (shared_ptr<dcp::ReelSubtitleAsset> (
new dcp::ReelSubtitleAsset (
_subtitle_content,