MCPcopy Create free account
hub / github.com/EndstoneMC/endstone / CppPluginLoader

Method CppPluginLoader

src/endstone/core/plugin/cpp_plugin_loader.cpp:41–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39namespace endstone::core {
40
41CppPluginLoader::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
63Plugin *CppPluginLoader::loadPlugin(std::string file)
64{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected