diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-05-09 21:33:56 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-05-25 01:30:31 +0200 |
| commit | 1e6484e0fe9e3fa090ef58e17433333a5378043c (patch) | |
| tree | 5bbb2e4efa39c5aee1d93bd618e5805b38ceb39f /src/lib/config.cc | |
| parent | 00706c7d9ded27a537af4e8182e67b460ec316bc (diff) | |
Improve save-template dialog and always use a default template.
Diffstat (limited to 'src/lib/config.cc')
| -rw-r--r-- | src/lib/config.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 879c29279..1269206ee 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -1385,6 +1385,13 @@ Config::set_dkdm_recipients_file(boost::filesystem::path file) void +Config::save_default_template(shared_ptr<const Film> film) const +{ + film->write_template(write_path("default.xml")); +} + + +void Config::save_template (shared_ptr<const Film> film, string name) const { film->write_template (template_write_path(name)); @@ -1420,6 +1427,18 @@ Config::template_read_path (string name) const boost::filesystem::path +Config::default_template_read_path() const +{ + if (!boost::filesystem::exists(read_path("default.xml"))) { + auto film = std::make_shared<const Film>(optional<boost::filesystem::path>()); + save_default_template(film); + } + + return read_path("default.xml"); +} + + +boost::filesystem::path Config::template_write_path (string name) const { return write_path("templates") / tidy_for_filename (name); |
