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

Method parse

projects/WinDurango.Common/src/Config.cpp:30–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28})";
29
30bool wd::common::Config::parse()
31{
32 try
33 {
34 if (!pDirectory->fileExists("winDurango.json")) {
35 pFile = pDirectory->CreateFile("winDurango.json");
36 pFile->open();
37 pFile->write(jsonTemplate);
38 } else {
39 pFile = pDirectory->CreateFile("winDurango.json");
40 pFile->open();
41 pFile->write(jsonTemplate);
42 }
43 std::string jsonData = pFile->read();
44 data = nlohmann::json::parse(jsonData);
45 return true;
46 }
47 catch (const std::exception &e)
48 {
49 return false;
50 }
51 catch (...)
52 {
53 return false;
54 }
55}
56
57const nlohmann::json& wd::common::Config::jsonData()
58{

Callers 1

InitMethod · 0.80

Calls 5

fileExistsMethod · 0.80
CreateFileMethod · 0.80
writeMethod · 0.80
readMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected