| 39 | namespace endstone::core { |
| 40 | |
| 41 | CppPluginLoader::CppPluginLoader(Server &server) : PluginLoader(server) |
| 42 | { |
| 43 | // prepare the temp folder |
| 44 | prefix_ = fs::current_path() / "plugins" / ".local"; |
| 45 | if (!exists(prefix_)) { |
| 46 | create_directory(prefix_); |
| 47 | } |
| 48 | |
| 49 | // remove old plugin files |
| 50 | for (const auto &entry : std::filesystem::directory_iterator(prefix_)) { |
| 51 | if (!is_regular_file(entry.status())) { |
| 52 | continue; |
| 53 | } |
| 54 | const auto &file = entry.path(); |
| 55 | for (const auto &pattern : CppPluginLoader::getPluginFileFilters()) { |
| 56 | if (std::regex r(pattern); std::regex_search(file.string(), r)) { |
| 57 | remove(file); |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | Plugin *CppPluginLoader::loadPlugin(std::string file) |
| 64 | { |
nothing calls this directly
no outgoing calls
no test coverage detected