Use dcp::compose rather than our own.
[dcpomatic.git] / src / lib / config.cc
index ce02b046e4e91635857ec0a2daee5df1535097dc..ce7651ea8c4cc9ad78c828c9fccca316a9de2509 100644 (file)
@@ -30,9 +30,9 @@
 #include "cross.h"
 #include "film.h"
 #include "dkdm_wrapper.h"
-#include "compose.hpp"
 #include "crypto.h"
 #include "dkdm_recipient.h"
+#include <dcp/compose.h>
 #include <dcp/raw_convert.h>
 #include <dcp/name_format.h>
 #include <dcp/certificate_chain.h>
@@ -176,6 +176,7 @@ Config::set_defaults ()
        _player_kdm_directory = boost::none;
        _audio_mapping = boost::none;
        _custom_languages.clear ();
+       _add_files_path = boost::none;
 
        _allowed_dcp_frame_rates.clear ();
        _allowed_dcp_frame_rates.push_back (24);
@@ -216,13 +217,13 @@ Config::backup ()
        /* Make a copy of the configuration */
        try {
                int n = 1;
-               while (n < 100 && boost::filesystem::exists(path(String::compose("config.xml.%1", n)))) {
+               while (n < 100 && boost::filesystem::exists(path(dcp::compose("config.xml.%1", n)))) {
                        ++n;
                }
 
-               boost::filesystem::copy_file(path("config.xml", false), path(String::compose("config.xml.%1", n), false));
-               boost::filesystem::copy_file(path("cinemas.xml", false), path(String::compose("cinemas.xml.%1", n), false));
-               boost::filesystem::copy_file(path("dkdm_recipients.xml", false), path(String::compose("dkdm_recipients.xml.%1", n), false));
+               boost::filesystem::copy_file(path("config.xml", false), path(dcp::compose("config.xml.%1", n), false));
+               boost::filesystem::copy_file(path("cinemas.xml", false), path(dcp::compose("cinemas.xml.%1", n), false));
+               boost::filesystem::copy_file(path("dkdm_recipients.xml", false), path(dcp::compose("dkdm_recipients.xml.%1", n), false));
        } catch (...) {}
 }
 
@@ -553,6 +554,8 @@ try
                } catch (std::runtime_error& e) {}
        }
 
+       _add_files_path = f.optional_string_child("AddFilesPath");
+
        if (boost::filesystem::exists (_cinemas_file)) {
                cxml::Document f ("Cinemas");
                f.read_file (_cinemas_file);
@@ -976,6 +979,10 @@ Config::write_config () const
        for (auto const& i: _custom_languages) {
                root->add_child("CustomLanguage")->add_child_text(i.to_string());
        }
+       if (_add_files_path) {
+               /* [XML] The default path that will be offered in the picker when adding files to a film */
+               root->add_child("AddFilesPath")->add_child_text(_add_files_path->string());
+       }
 
        try {
                auto const s = doc.write_to_string_formatted ();