| 1693 | } |
| 1694 | |
| 1695 | size_t loadScriptFiles(Core* core, color_ostream& out, const std::span<const std::string> prefix, const std::filesystem::path& folder) { |
| 1696 | static const std::string suffix = ".init"; |
| 1697 | std::vector<std::filesystem::path> scriptFiles; |
| 1698 | for ( const auto& p : prefix ) { |
| 1699 | getFilesWithPrefixAndSuffix(folder, p, ".init", scriptFiles); |
| 1700 | } |
| 1701 | |
| 1702 | std::ranges::sort(scriptFiles, |
| 1703 | [](const std::filesystem::path& a, const std::filesystem::path& b) { |
| 1704 | return a.stem() < b.stem(); |
| 1705 | }); |
| 1706 | |
| 1707 | size_t result = 0; |
| 1708 | for ( const auto& file : scriptFiles) { |
| 1709 | result++; |
| 1710 | core->loadScriptFile(out, folder / file, false); |
| 1711 | } |
| 1712 | return result; |
| 1713 | } |
| 1714 | |
| 1715 | namespace DFHack { |
| 1716 | namespace X { |
no test coverage detected