diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2021-10-23 02:24:24 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2021-10-23 02:24:24 +0200 |
commit | 47f09ad8fb52de7ee9ed6c63574ea2f77e314fa2 (patch) | |
tree | 4259d1e1578d4ad7df3e05c0876723928bb9532f /src/TemplateManager.cpp | |
parent | ca7ca2218e07a24075cdc9d48e967cfdc2a3543b (diff) |
Sort filenames alpha-numeric, used as template system dependency management.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/TemplateManager.cpp')
-rw-r--r-- | src/TemplateManager.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/TemplateManager.cpp b/src/TemplateManager.cpp index 62b4e27..2c58306 100644 --- a/src/TemplateManager.cpp +++ b/src/TemplateManager.cpp @@ -38,11 +38,15 @@ TemplateManager::TemplateManager() void TemplateManager::ParseTemplates(Filesystem & fs) { - for (auto & tpl : fs.GetFiles()) + std::vector<std::string> sortedFilenames; + auto & files = fs.GetFiles(); + + fs.GetFilenamesSorted(sortedFilenames); + for (auto const & tpl : sortedFilenames) { - std::string tmpl(tpl.second.data.data(), tpl.second.data.data() + tpl.second.data.size()); - m_Inja.include_template(tpl.first, m_Inja.parse(tmpl)); - std::cout << "File: " << tpl.first << " may contain a renderable template." << std::endl; + std::string tmpl(files[tpl].data.data(), files[tpl].data.data() + files[tpl].data.size()); + m_Inja.include_template(tpl, m_Inja.parse(tmpl)); + std::cout << "File: " << tpl << " may contain a renderable template." << std::endl; } } |