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

Method getScriptPaths

library/Core.cpp:498–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496}
497
498void Core::getScriptPaths(std::vector<std::filesystem::path> *dest)
499{
500 std::lock_guard<std::mutex> lock(script_path_mutex);
501 dest->clear();
502 std::filesystem::path df_pref_path = Filesystem::getBaseDir();
503 std::filesystem::path df_install_path = Filesystem::getInstallDir();
504 for (auto & path : script_paths[0])
505 dest->emplace_back(path);
506 // should this be df_pref_path? probably
507 dest->push_back(getConfigPath() / "scripts");
508 if (df::global::world && isWorldLoaded()) {
509 std::string save = World::ReadWorldFolder();
510 if (save.size())
511 dest->emplace_back(df_pref_path / "save" / save / "scripts");
512 }
513 dest->emplace_back(getHackPath() / "scripts");
514 for (auto & path : script_paths[2])
515 dest->emplace_back(path);
516 for (auto & path : script_paths[1])
517 dest->emplace_back(path);
518}
519
520std::filesystem::path Core::findScript(std::string name)
521{

Callers 1

internal_getScriptPathsFunction · 0.80

Calls 5

getConfigPathFunction · 0.85
getHackPathFunction · 0.85
isWorldLoadedFunction · 0.70
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected