void expander::expand( const boost::optional<boost::filesystem::path>& template_path, dynamic::object& o) const { BOOST_LOG_SEV(lg, debug) << "Before expansion: " << o; if (!template_path) { BOOST_LOG_SEV(lg, debug) << "No template path supplied so not performing expansion"; return; } BOOST_LOG_SEV(lg, debug) << "Template path: " << template_path->generic_string(); std::string output_filename(template_path->stem().generic_string()); output_filename += stitch_postfix; const dynamic::field_selector fs(o); boost::filesystem::path absolute_output_directory; if (fs.has_field(traits::relative_output_directory())) { const auto tc(fs.get_text_content(traits::relative_output_directory())); using namespace boost::filesystem; path rel_dir(tc); absolute_output_directory = absolute(rel_dir, template_path->parent_path()); } else absolute_output_directory = template_path->parent_path(); absolute_output_directory /= output_filename; const dynamic::field_instance_factory f; const auto v(f.make_text(absolute_output_directory.generic_string())); o.fields()[traits::output_path()] = v; BOOST_LOG_SEV(lg, debug) << "After expansion: " << o; }