+2018-04-29 Carl Hetherington <cth@carlh.net>
+
+ * Add command-line option to specify directory containing config (#1284).
+
2018-04-27 Carl Hetherington <cth@carlh.net>
* Fix incorrect container size when loading a OV/VF combination into the player.
boost::signals2::signal<void ()> Config::FailedToLoad;
boost::signals2::signal<void (string)> Config::Warning;
boost::signals2::signal<bool (void)> Config::BadSignerChain;
-boost::optional<boost::filesystem::path> Config::test_path;
+boost::optional<boost::filesystem::path> Config::override_path;
/** Construct default configuration */
Config::Config ()
Config::path (string file, bool create_directories)
{
boost::filesystem::path p;
- if (test_path) {
- p = test_path.get();
+ if (override_path) {
+ p = *override_path;
} else {
#ifdef DCPOMATIC_OSX
p /= g_get_home_dir ();
static bool have_existing (std::string);
static boost::filesystem::path config_file ();
- static boost::optional<boost::filesystem::path> test_path;
-
+ /** If set, this overrides the standard path (in home, Library, AppData or wherever) for config.xml and cinemas.xml */
+ static boost::optional<boost::filesystem::path> override_path;
+
private:
Config ();
static boost::filesystem::path path (std::string file, bool create_directories = true);
<< " -s, --servers <file> specify servers to use in a text file\n"
<< " -l, --list-servers just display a list of encoding servers that DCP-o-matic is configured to use; don't encode\n"
<< " -d, --dcp-path echo DCP's path to stdout on successful completion (implies -n)\n"
+ << " -c, --config <dir> directory containing config.xml and cinemas.xml\n"
<< " --dump just dump a summary of the film's settings; don't encode\n"
<< "\n"
<< "<FILM> is the film directory.\n";
optional<boost::filesystem::path> servers;
bool list_servers_ = false;
bool dcp_path = false;
+ optional<boost::filesystem::path> config;
int option_index = 0;
while (true) {
{ "servers", required_argument, 0, 's' },
{ "list-servers", no_argument, 0, 'l' },
{ "dcp-path", no_argument, 0, 'd' },
+ { "config", required_argument, 0, 'c' },
/* Just using A, B, C ... from here on */
{ "dump", no_argument, 0, 'A' },
{ 0, 0, 0, 0 }
};
- int c = getopt_long (argc, argv, "vhfnrt:j:kAs:ld", long_options, &option_index);
+ int c = getopt_long (argc, argv, "vhfnrt:j:kAs:ldc:", long_options, &option_index);
if (c == -1) {
break;
dcp_path = true;
progress = false;
break;
+ case 'c':
+ config = optarg;
+ break;
}
}
+ if (config) {
+ Config::override_path = *config;
+ }
+
if (servers) {
FILE* f = fopen_boost (*servers, "r");
if (!f) {
#include "lib/image_content.h"
#include "lib/video_content.h"
#include "lib/cross.h"
+#include "lib/config.h"
#include "lib/dcp_content.h"
#include <dcp/exceptions.h>
#include <libxml++/libxml++.h>
<< " --standard <standard> SMPTE or interop (default SMPTE)\n"
<< " --no-use-isdcf-name do not use an ISDCF name; use the specified name unmodified\n"
<< " --no-sign do not sign the DCP\n"
+ << " --config <dir> directory containing config.xml and cinemas.xml\n"
<< " -o, --output <dir> output directory\n";
}
optional<boost::filesystem::path> output;
bool sign = true;
bool use_isdcf_name = true;
+ optional<boost::filesystem::path> config;
int option_index = 0;
while (true) {
{ "no-use-isdcf-name", no_argument, 0, 'D'},
{ "no-sign", no_argument, 0, 'E'},
{ "output", required_argument, 0, 'o'},
+ { "config", required_argument, 0, 'F'},
{ 0, 0, 0, 0}
};
- int c = getopt_long (argc, argv, "vhn:f:c:f:A:B:C:s:o:DE", long_options, &option_index);
+ int c = getopt_long (argc, argv, "vhn:f:c:f:A:B:C:s:o:DEF:", long_options, &option_index);
if (c == -1) {
break;
}
case 'E':
sign = false;
break;
+ case 'F':
+ config = optarg;
+ break;
case 's':
still_length = atoi (optarg);
break;
exit (EXIT_FAILURE);
}
+ if (config) {
+ Config::override_path = *config;
+ }
+
if (!content_ratio) {
cerr << argv[0] << ": missing required option --content-ratio.\n";
exit (EXIT_FAILURE);
boost::system::error_code ec;
boost::filesystem::remove ("build/test/config.xml", ec);
- Config::test_path = "build/test";
+ Config::override_path = "build/test";
ofstream f ("build/test/config.xml");
f << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
<< "<Config>\n"