Add new LocalTime constructor.
[libdcp.git] / src / asset.cc
index a800e8ee055c1c13696d6e0184790e4f9d5a9ea5..81321d4da8325962d9c505054ebbf76e76b602ee 100644 (file)
@@ -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);