| 358 | } |
| 359 | |
| 360 | bool 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: |
no test coverage detected