aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 98f19c5..6d41907 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -88,33 +88,37 @@ int main(int argc, char ** argv)
port = atoi(argv[2]);
}
- std::shared_ptr<Filesystem> static_fs = std::make_shared<Filesystem>();
- if (argc > 3)
+ std::shared_ptr<TemplateManager> tmgr = std::make_shared<TemplateManager>();
+ std::shared_ptr<ContentManager> ctmgr = std::make_shared<ContentManager>();
+ ctmgr->SetTemplateSystem(tmgr);
+
{
- if (static_fs->Scan(argv[3]) != true)
+ Filesystem static_fs;
+ if (argc > 3)
{
- return 1;
+ if (static_fs.Scan(argv[3]) != true)
+ {
+ return 1;
+ }
}
+ static_fs.Scan("./wwwroot", {"html", "tmpl"}, true);
}
- static_fs->Scan("./wwwroot", {"html", "tmpl"}, true);
- Filesystem dynamic_fs;
- if (argc > 4)
{
- if (dynamic_fs.Scan(argv[4]) != true)
+ Filesystem dynamic_fs;
+ if (argc > 4)
{
- return 1;
+ if (dynamic_fs.Scan(argv[4]) != true)
+ {
+ return 1;
+ }
}
- }
- dynamic_fs.Scan("./wwwroot", {"html", "tmpl"}, false);
+ dynamic_fs.Scan("./wwwroot", {"html", "tmpl"}, false);
- std::shared_ptr<TemplateManager> tmgr = std::make_shared<TemplateManager>();
- tmgr->ParseTemplates(dynamic_fs);
+ tmgr->ParseTemplates(dynamic_fs);
+ }
- std::shared_ptr<ContentManager> ctmgr = std::make_shared<ContentManager>();
- ctmgr->SetStaticFilesystem(static_fs);
- ctmgr->SetTemplateSystem(tmgr);
- ctmgr->RegisterModule(std::make_shared<Blog>("/blog", "index.html"));
+ ctmgr->RegisterModule(std::make_shared<Blog>("/blog", "index.html", "./blog"));
if (ctmgr->InitAll() == false)
{