projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
02ceebe
)
Allow command-line configuration of config location (#1284).
author
Carl Hetherington
<cth@carlh.net>
Sat, 28 Apr 2018 23:37:13 +0000
(
00:37
+0100)
committer
Carl Hetherington
<cth@carlh.net>
Mon, 6 Aug 2018 22:01:28 +0000
(23:01 +0100)
ChangeLog
patch
|
blob
|
history
src/lib/config.cc
patch
|
blob
|
history
src/lib/config.h
patch
|
blob
|
history
src/tools/dcpomatic_cli.cc
patch
|
blob
|
history
src/tools/dcpomatic_create.cc
patch
|
blob
|
history
test/config_test.cc
patch
|
blob
|
history
diff --git
a/ChangeLog
b/ChangeLog
index d35308f063d0808d0e3ccbef1dbaa465f448609e..7ff9bd6526b0852bbf653a4c66e9339f25ad7adf 100644
(file)
--- a/
ChangeLog
+++ b/
ChangeLog
@@
-1,5
+1,9
@@
2018-07-18 Carl Hetherington <cth@carlh.net>
2018-07-18 Carl Hetherington <cth@carlh.net>
+ * Add command-line option to specify directory containing config (#1284).
+
+2018-04-27 Carl Hetherington <cth@carlh.net>
+
* Version 2.12.8 released.
2018-06-07 Carl Hetherington <cth@carlh.net>
* Version 2.12.8 released.
2018-06-07 Carl Hetherington <cth@carlh.net>
diff --git
a/src/lib/config.cc
b/src/lib/config.cc
index 2ae7939a9e7bcf7ad725c2ec6176d6f29ffce4cc..e2f2bbeb97a81fff2ccbf19ae50798916394cd89 100644
(file)
--- a/
src/lib/config.cc
+++ b/
src/lib/config.cc
@@
-68,7
+68,7
@@
int const Config::_current_version = 3;
boost::signals2::signal<void ()> Config::FailedToLoad;
boost::signals2::signal<void (string)> Config::Warning;
boost::signals2::signal<bool (void)> Config::BadSignerChain;
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 ()
/** Construct default configuration */
Config::Config ()
@@
-456,8
+456,8
@@
boost::filesystem::path
Config::path (string file, bool create_directories)
{
boost::filesystem::path p;
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 ();
} else {
#ifdef DCPOMATIC_OSX
p /= g_get_home_dir ();
diff --git
a/src/lib/config.h
b/src/lib/config.h
index 2fca9699c786006d5819064ecb0acb4b1e5a49c5..c625e92424247314004232d92d48264d1314520b 100644
(file)
--- a/
src/lib/config.h
+++ b/
src/lib/config.h
@@
-721,8
+721,9
@@
public:
static bool have_existing (std::string);
static boost::filesystem::path config_file ();
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);
private:
Config ();
static boost::filesystem::path path (std::string file, bool create_directories = true);
diff --git
a/src/tools/dcpomatic_cli.cc
b/src/tools/dcpomatic_cli.cc
index 31681a7fca7c7e9341f89b0cba2dd7ee041e7dad..deea8b25332263a32fd5d275cd89cbb35cf21329 100644
(file)
--- a/
src/tools/dcpomatic_cli.cc
+++ b/
src/tools/dcpomatic_cli.cc
@@
-65,6
+65,7
@@
help (string n)
<< " -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"
<< " -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";
<< " --dump just dump a summary of the film's settings; don't encode\n"
<< "\n"
<< "<FILM> is the film directory.\n";
@@
-191,6
+192,7
@@
main (int argc, char* argv[])
optional<boost::filesystem::path> servers;
bool list_servers_ = false;
bool dcp_path = false;
optional<boost::filesystem::path> servers;
bool list_servers_ = false;
bool dcp_path = false;
+ optional<boost::filesystem::path> config;
int option_index = 0;
while (true) {
int option_index = 0;
while (true) {
@@
-206,12
+208,13
@@
main (int argc, char* argv[])
{ "servers", required_argument, 0, 's' },
{ "list-servers", no_argument, 0, 'l' },
{ "dcp-path", no_argument, 0, 'd' },
{ "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 }
};
/* 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:ld
c:
", long_options, &option_index);
if (c == -1) {
break;
if (c == -1) {
break;
@@
-255,9
+258,16
@@
main (int argc, char* argv[])
dcp_path = true;
progress = false;
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) {
if (servers) {
FILE* f = fopen_boost (*servers, "r");
if (!f) {
diff --git
a/src/tools/dcpomatic_create.cc
b/src/tools/dcpomatic_create.cc
index a9d1165f14c02a563d93ca268974c2544a0050c0..5c6fc3567f2f512953b24e8afa1ff8b893417279 100644
(file)
--- a/
src/tools/dcpomatic_create.cc
+++ b/
src/tools/dcpomatic_create.cc
@@
-30,6
+30,7
@@
#include "lib/image_content.h"
#include "lib/video_content.h"
#include "lib/cross.h"
#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>
#include "lib/dcp_content.h"
#include <dcp/exceptions.h>
#include <libxml++/libxml++.h>
@@
-66,6
+67,7
@@
syntax (string n)
<< " --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"
<< " --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";
}
<< " -o, --output <dir> output directory\n";
}
@@
-105,6
+107,7
@@
main (int argc, char* argv[])
optional<boost::filesystem::path> output;
bool sign = true;
bool use_isdcf_name = true;
optional<boost::filesystem::path> output;
bool sign = true;
bool use_isdcf_name = true;
+ optional<boost::filesystem::path> config;
int option_index = 0;
while (true) {
int option_index = 0;
while (true) {
@@
-122,10
+125,11
@@
main (int argc, char* argv[])
{ "no-use-isdcf-name", no_argument, 0, 'D'},
{ "no-sign", no_argument, 0, 'E'},
{ "output", required_argument, 0, 'o'},
{ "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}
};
{ 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:DE
F:
", long_options, &option_index);
if (c == -1) {
break;
}
if (c == -1) {
break;
}
@@
-185,6
+189,9
@@
main (int argc, char* argv[])
case 'E':
sign = false;
break;
case 'E':
sign = false;
break;
+ case 'F':
+ config = optarg;
+ break;
case 's':
still_length = atoi (optarg);
break;
case 's':
still_length = atoi (optarg);
break;
@@
-202,6
+209,10
@@
main (int argc, char* argv[])
exit (EXIT_FAILURE);
}
exit (EXIT_FAILURE);
}
+ if (config) {
+ Config::override_path = *config;
+ }
+
if (!content_ratio) {
cerr << argv[0] << ": missing required option --content-ratio.\n";
exit (EXIT_FAILURE);
if (!content_ratio) {
cerr << argv[0] << ": missing required option --content-ratio.\n";
exit (EXIT_FAILURE);
diff --git
a/test/config_test.cc
b/test/config_test.cc
index dad545a48e89db4a83c992f14dd63168c4ceaa43..14cceb6a0df30100849a9565e733fbec032902fd 100644
(file)
--- a/
test/config_test.cc
+++ b/
test/config_test.cc
@@
-31,7
+31,7
@@
rewrite_bad_config ()
boost::system::error_code ec;
boost::filesystem::remove ("build/test/config.xml", ec);
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"
ofstream f ("build/test/config.xml");
f << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
<< "<Config>\n"