MCPcopy Create free account
hub / github.com/DFHack/dfhack / loadScriptFiles

Function loadScriptFiles

library/Core.cpp:1695–1713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1693}
1694
1695size_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
1715namespace DFHack {
1716 namespace X {

Callers 2

run_dfhack_initFunction · 0.85

Calls 3

sortFunction · 0.85
loadScriptFileMethod · 0.80

Tested by

no test coverage detected