summaryrefslogtreecommitdiff
path: root/src/asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-10-28 10:24:44 +0000
committerCarl Hetherington <cth@carlh.net>2015-10-28 10:24:44 +0000
commit6dc0cdbd5be3f8f60bd50523501a0bd85666ebda (patch)
tree1897931ca1a054d4181818272d723a81513ac39b /src/asset.cc
parent34bacd283bd73cf697079459b0ad9e91bca349de (diff)
Don't add external (referenced) assets to the PKL.
Diffstat (limited to 'src/asset.cc')
-rw-r--r--src/asset.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/asset.cc b/src/asset.cc
index a800e8ee..81321d4d 100644
--- a/src/asset.cc
+++ b/src/asset.cc
@@ -58,10 +58,22 @@ Asset::Asset (string id, boost::filesystem::path file)
}
void
-Asset::write_to_pkl (xmlpp::Node* node, Standard standard) const
+Asset::write_to_pkl (xmlpp::Node* node, boost::filesystem::path root, Standard standard) const
{
DCP_ASSERT (!_file.empty ());
+ optional<boost::filesystem::path> path = relative_to_root (
+ boost::filesystem::canonical (root),
+ boost::filesystem::canonical (_file)
+ );
+
+ if (!path) {
+ /* 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);
asset->add_child("AnnotationText")->add_child_text (_id);