MCPcopy Create free account
hub / github.com/WinDurango/WinDurango / Init

Method Init

projects/WinDurango.Common/src/WinDurango.cpp:24–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 {
23 return _inited;
24 }
25
26 void WinDurango::Init(std::shared_ptr<interfaces::storage::Directory> root)
27 {
28 if (this->_inited)
29 {
30 return;
31 }
32 try
33 {
34 rootDir = root;
35 rootDir->open();
36
37 std::time_t timestamp = std::time(nullptr);
38 std::tm datetm = *std::localtime(&timestamp);
39
40 char buf[512];
41 std::strftime(buf, sizeof(buf), "%d.%m.%Y", &datetm);
42
43 std::string date(buf);
44 WinDurangoRoot = rootDir->CreateFolder("WinDurango");
45 WinDurangoRoot->open();
46
47 std::shared_ptr<interfaces::storage::File> LogFile =
48 WinDurangoRoot->CreateFile("windurango_log_" + date + ".log");
49
50 config = Config(WinDurangoRoot);
51 log = Logging(LogFile);
52
53 config.parse();
54 log.Initialize();
55
56 this->_inited = true;
57 }
58 catch (const std::exception &e)
59 {
60 std::cout << "[WinDurango::Common::WinDurango.exception] - Critical: " << e.what() << "\n";
61 }
62 catch (...)
63 {
64 std::cout << "[WinDurango::Common::WinDurango.(...))] - Critical: Unknown Error\n";
65 }
66 }
67} // namespace wd::common

Callers 1

WdRoGetActivationFactoryFunction · 0.80

Calls 6

ConfigFunction · 0.85
LoggingFunction · 0.85
CreateFileMethod · 0.80
parseMethod · 0.80
openMethod · 0.45
InitializeMethod · 0.45

Tested by

no test coverage detected