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

Method findScript

library/Core.cpp:520–539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518}
519
520std::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
541bool loadScriptPaths(color_ostream &out, bool silent = false)
542{

Callers 3

enableMethod · 0.80
typeMethod · 0.80
internal_findScriptFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected