| 539 | } |
| 540 | |
| 541 | bool loadScriptPaths(color_ostream &out, bool silent = false) |
| 542 | { |
| 543 | std::filesystem::path filename{ getConfigPath() / "script-paths.txt" }; |
| 544 | std::ifstream file(filename); |
| 545 | if (!file) |
| 546 | { |
| 547 | if (!silent) |
| 548 | out.printerr("Could not load {}\n", filename); |
| 549 | return false; |
| 550 | } |
| 551 | std::string raw; |
| 552 | int line = 0; |
| 553 | while (getline(file, raw)) |
| 554 | { |
| 555 | ++line; |
| 556 | std::istringstream ss(raw); |
| 557 | char ch; |
| 558 | ss >> std::skipws; |
| 559 | if (!(ss >> ch) || ch == '#') |
| 560 | continue; |
| 561 | ss >> std::ws; // discard whitespace |
| 562 | std::string path; |
| 563 | getline(ss, path); |
| 564 | if (ch == '+' || ch == '-') |
| 565 | { |
| 566 | if (!Core::getInstance().addScriptPath(path, ch == '+') && !silent) |
| 567 | out.printerr("{}:{}: Failed to add path: {}\n", filename, line, path); |
| 568 | } |
| 569 | else if (!silent) |
| 570 | out.printerr("{}:{}: Illegal character: {}\n", filename, line, ch); |
| 571 | } |
| 572 | return true; |
| 573 | } |
| 574 | |
| 575 | static void loadModScriptPaths(color_ostream &out) { |
| 576 | std::vector<std::string> mod_script_paths_str; |
no test coverage detected