+
+void
+Config::save_template (shared_ptr<const Film> film, string name) const
+{
+ film->write_template (template_path (name));
+}
+
+list<string>
+Config::templates () const
+{
+ if (!boost::filesystem::exists (path ("templates"))) {
+ return list<string> ();
+ }
+
+ 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);
+}
+
+void
+Config::rename_template (string old_name, string new_name) const
+{
+ boost::filesystem::rename (template_path (old_name), template_path (new_name));
+}
+
+void
+Config::delete_template (string name) const
+{
+ boost::filesystem::remove (template_path (name));
+}