diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-24 11:40:34 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-24 14:28:32 +0100 |
| commit | 1a693725f9a8cc6ba58f65b2f1ef03255d295f23 (patch) | |
| tree | 91596f7800dcc02103c90f8f19c763f45281603e /src/lib/config.cc | |
| parent | a03e9a98ed667eb44c9dfbbeaf6da57f44992914 (diff) | |
Basic template support (#485).
Diffstat (limited to 'src/lib/config.cc')
| -rw-r--r-- | src/lib/config.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 4184a7d1d..8f9cfab4b 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -29,6 +29,7 @@ #include "cinema.h" #include "util.h" #include "cross.h" +#include "film.h" #include <dcp/raw_convert.h> #include <dcp/name_format.h> #include <dcp/colour_matrix.h> @@ -588,3 +589,31 @@ Config::set_cinemas_file (boost::filesystem::path file) changed (OTHER); } + +void +Config::save_template (shared_ptr<const Film> film, string name) const +{ + film->write_template (template_path (name)); +} + +list<string> +Config::template_names () const +{ + list<string> n; + for (boost::filesystem::directory_iterator i (path("templates")); i != boost::filesystem::directory_iterator(); ++i) { + n.push_back (i->path().filename().string()); + } + return n; +} + +bool +Config::existing_template (string name) const +{ + return boost::filesystem::exists (template_path (name)); +} + +boost::filesystem::path +Config::template_path (string name) const +{ + return path("templates") / tidy_for_filename (name); +} |
