| 496 | } |
| 497 | |
| 498 | void 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 | |
| 520 | std::filesystem::path Core::findScript(std::string name) |
| 521 | { |
no test coverage detected