Remove all use of add_child() from xmlpp.
[dcpomatic.git] / src / lib / spl.cc
index 3e5e957ff457792257e37c243add266e2feb4524..e87465cdc5dd6909bf71ef05fbce63fe86ce6e06 100644 (file)
@@ -22,6 +22,7 @@
 #include "content_store.h"
 #include "spl.h"
 #include <libcxml/cxml.h>
+#include <dcp/filesystem.h>
 #include <dcp/raw_convert.h>
 #include <dcp/warnings.h>
 LIBDCP_DISABLE_WARNINGS
@@ -42,7 +43,7 @@ SPL::read (boost::filesystem::path path, ContentStore* store)
        _spl.clear ();
        _missing = false;
        cxml::Document doc ("SPL");
-       doc.read_file (path);
+       doc.read_file(dcp::filesystem::fix_long_path(path));
        _id = doc.string_child("Id");
        _name = doc.string_child("Name");
        for (auto i: doc.node_children("Entry")) {
@@ -61,10 +62,10 @@ SPL::write (boost::filesystem::path path) const
 {
        xmlpp::Document doc;
        auto root = doc.create_root_node ("SPL");
-       root->add_child("Id")->add_child_text (_id);
-       root->add_child("Name")->add_child_text (_name);
+       cxml::add_text_child(root, "Id", _id);
+       cxml::add_text_child(root, "Name", _name);
        for (auto i: _spl) {
-               i.as_xml (root->add_child("Entry"));
+               i.as_xml(cxml::add_child(root, "Entry"));
        }
        doc.write_to_file_formatted (path.string());
 }