MCPcopy Create free account
hub / github.com/Rezonality/zep / LoadConfig

Method LoadConfig

src/editor.cpp:130–158  ·  view source on GitHub ↗

If you pass a valid path to a 'zep.cfg' file, then editor settings will serialize from that You can even edit it inside zep for immediate changes :)

Source from the content-addressed store, hash-verified

128// If you pass a valid path to a 'zep.cfg' file, then editor settings will serialize from that
129// You can even edit it inside zep for immediate changes :)
130void ZepEditor::LoadConfig(const ZepPath& config_path)
131{
132 if (!GetFileSystem().Exists(config_path))
133 {
134 return;
135 }
136
137 try
138 {
139 std::shared_ptr<cpptoml::table> spConfig;
140 spConfig = cpptoml::parse_file(config_path.string());
141 if (spConfig == nullptr)
142 return;
143
144 LoadConfig(spConfig);
145 }
146 catch (cpptoml::parse_exception& ex)
147 {
148 std::ostringstream str;
149 str << config_path.filename().string() << " : Failed to parse. " << ex.what();
150 SetCommandText(str.str());
151 }
152 catch (...)
153 {
154 std::ostringstream str;
155 str << config_path.filename().string() << " : Failed to parse. ";
156 SetCommandText(str.str());
157 }
158}
159
160void ZepEditor::LoadConfig(std::shared_ptr<cpptoml::table> spConfig)
161{

Callers

nothing calls this directly

Calls 8

parse_fileFunction · 0.85
string_tolowerFunction · 0.85
filenameMethod · 0.80
strMethod · 0.80
value_orMethod · 0.80
ExistsMethod · 0.45
stringMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected