MCPcopy Create free account
hub / github.com/crossuo/crossuo / LoadGlobalConfig

Function LoadGlobalConfig

src/Config.cpp:360–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360bool LoadGlobalConfig()
361{
362 auto cfg = GetConfigFile();
363 Info(Config, "loading global config from: '%s'", fs_path_ascii(cfg));
364 if (!fs_path_exists(cfg))
365 {
366 cfg = fs_path_join(fs_path_current(), cfg);
367 }
368
369 if (!fs_path_exists(cfg))
370 {
371 Info(Config, "config not found");
372 return false;
373 }
374
375 TextFileParser file(cfg, "=,", "#;", "");
376 while (!file.IsEOF())
377 {
378 auto strings = file.ReadTokens(false); // Trim remove spaces from paths
379 if (strings.size() >= 2)
380 {
381 const auto key = config::GetConfigKey(strings[0]);
382 if (key == MSCC_USE_KEYS)
383 {
384 Info(
385 Config,
386 "\t%s=%s,%s,%s,%s",
387 config::s_Keys[key - 1].key_name,
388 strings[1].c_str(),
389 strings[2].c_str(),
390 strings[3].c_str(),
391 strings[4].c_str());
392 }
393 else if (key != MSCC_NONE && key != MSCC_ACTPWD)
394 {
395 Info(Config, "\t%s=%s", config::s_Keys[key - 1].key_name, strings[1].c_str());
396 }
397 switch (key)
398 {
399 case MSCC_CLIENT_VERSION:
400 {
401 g_Config.ClientVersionString = strings[1];
402 g_Config.ClientVersionModified = true;
403 }
404 break;
405 case MSCC_PROTOCOL_CLIENT_VERSION:
406 {
407 g_Config.ProtocolClientVersionString = strings[1];
408 s_Mark.ProtocolVersion = true;
409 }
410 break;
411 case MSCC_CUSTOM_PATH:
412 {
413 g_App.m_UOPath = fs_path_from(strings[1]);
414 fs_case_insensitive_init(g_App.m_UOPath);
415 }
416 break;
417 case MSCC_ACTID:

Callers 1

load_configFunction · 0.85

Calls 15

GetConfigFileFunction · 0.85
fs_path_asciiFunction · 0.85
fs_path_existsFunction · 0.85
fs_path_joinFunction · 0.85
fs_path_currentFunction · 0.85
fs_path_fromFunction · 0.85
fs_case_insensitive_initFunction · 0.85
str_to_boolFunction · 0.85
str_to_intFunction · 0.85
GetClientTypeFromStringFunction · 0.85
str_upperFunction · 0.85
ClientVersionFixupFunction · 0.85

Tested by

no test coverage detected