Cleanup: fix more comments/guards (and add check script).
[libdcp.git] / src / interop_subtitle_asset.cc
index e7c1432b75ee56b6972020a85c4c93175aaa275e..a45942077f1f87da33a9b101f0eae39fdd71b6c8 100644 (file)
@@ -39,6 +39,8 @@
 
 #include "compose.hpp"
 #include "dcp_assert.h"
+#include "equality_options.h"
+#include "filesystem.h"
 #include "font_asset.h"
 #include "file.h"
 #include "interop_load_font_node.h"
@@ -74,7 +76,7 @@ InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file)
        _raw_xml = dcp::file_to_string (file);
 
        auto xml = make_shared<cxml::Document>("DCSubtitle");
-       xml->read_file (file);
+       xml->read_file(dcp::filesystem::fix_long_path(file));
        _id = xml->string_child ("SubtitleID");
        _reel_number = xml->string_child ("ReelNumber");
        _language = xml->string_child ("Language");
@@ -113,13 +115,13 @@ InteropSubtitleAsset::xml_as_string () const
        auto root = doc.create_root_node ("DCSubtitle");
        root->set_attribute ("Version", "1.0");
 
-       root->add_child("SubtitleID")->add_child_text (_id);
-       root->add_child("MovieTitle")->add_child_text (_movie_title);
-       root->add_child("ReelNumber")->add_child_text (raw_convert<string> (_reel_number));
-       root->add_child("Language")->add_child_text (_language);
+       cxml::add_text_child(root, "SubtitleID", _id);
+       cxml::add_text_child(root, "MovieTitle", _movie_title);
+       cxml::add_text_child(root, "ReelNumber", raw_convert<string> (_reel_number));
+       cxml::add_text_child(root, "Language", _language);
 
        for (auto i: _load_font_nodes) {
-               auto load_font = root->add_child("LoadFont");
+               auto load_font = cxml::add_child(root, "LoadFont");
                load_font->set_attribute ("Id", i->id);
                load_font->set_attribute ("URI", i->uri);
        }