diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-09-16 00:51:07 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-09-16 00:51:07 +0100 |
| commit | 14848004f619d11bd6810735637d428f101e6b51 (patch) | |
| tree | e2aa460b25f98db37523c2ea92cc3997c3745336 /src/asset.cc | |
| parent | a6070a8af446620ab16ad172b94041601c95700d (diff) | |
Consider assets outside the DCP as referenced assets (i.e.1.0-vf
not to be written to the asset map). Return a value from
finalize() to say whether a writer has written anything.
Other small related tweaks.
Diffstat (limited to 'src/asset.cc')
| -rw-r--r-- | src/asset.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/asset.cc b/src/asset.cc index 3ee95227..a800e8ee 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -75,20 +75,23 @@ Asset::write_to_assetmap (xmlpp::Node* node, boost::filesystem::path root) const { DCP_ASSERT (!_file.empty ()); - xmlpp::Node* asset = node->add_child ("Asset"); - asset->add_child("Id")->add_child_text ("urn:uuid:" + _id); - xmlpp::Node* chunk_list = asset->add_child ("ChunkList"); - xmlpp::Node* chunk = chunk_list->add_child ("Chunk"); - optional<boost::filesystem::path> path = relative_to_root ( boost::filesystem::canonical (root), boost::filesystem::canonical (_file) ); if (!path) { - throw MiscError (String::compose ("Asset %1 is not within the directory %2", _file, root)); + /* The path of this asset is not within our DCP, so we assume it's an external + (referenced) one. + */ + return; } + xmlpp::Node* asset = node->add_child ("Asset"); + asset->add_child("Id")->add_child_text ("urn:uuid:" + _id); + xmlpp::Node* chunk_list = asset->add_child ("ChunkList"); + xmlpp::Node* chunk = chunk_list->add_child ("Chunk"); + /* On Windows path.string() will contain back-slashes; replace these with forward-slashes. XXX: perhaps there is a nicer way to do this with boost. */ |
