| 518 | } |
| 519 | |
| 520 | std::filesystem::path Core::findScript(std::string name) |
| 521 | { |
| 522 | std::vector<std::filesystem::path> paths; |
| 523 | getScriptPaths(&paths); |
| 524 | for (auto& path : paths) |
| 525 | { |
| 526 | std::error_code ec; |
| 527 | auto raw_path = path / name; |
| 528 | std::filesystem::path load_path = std::filesystem::weakly_canonical(raw_path, ec); |
| 529 | if (ec) |
| 530 | { |
| 531 | con.printerr("Error loading '{}' ({})\n", raw_path, ec.message()); |
| 532 | continue; |
| 533 | } |
| 534 | |
| 535 | if (Filesystem::isfile(load_path)) |
| 536 | return load_path; |
| 537 | } |
| 538 | return {}; |
| 539 | } |
| 540 | |
| 541 | bool loadScriptPaths(color_ostream &out, bool silent = false) |
| 542 | { |
no outgoing calls
no test coverage detected