diff options
| author | 2019-07-16 15:11:21 +0100 | |
|---|---|---|
| committer | 2019-07-16 16:48:18 +0100 | |
| commit | cd8b456f979733525941284639d8bf899173b429 (patch) | |
| tree | f1d26962e61c74c5acb076662a909beafbe8e5fd /src/modulemanager.cpp | |
| parent | Replace socketengine_{pthread,win32} with C++11 threads. (diff) | |
| parent | ssl_gnutls: remove PackageInfo directives for EOL Debian versions. (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modulemanager.cpp')
| -rw-r--r-- | src/modulemanager.cpp | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 1883cf028..c1a7e9337 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -21,10 +21,6 @@ #include "exitcodes.h" #include <iostream> -#ifndef _WIN32 -#include <dirent.h> -#endif - bool ModuleManager::Load(const std::string& modname, bool defer) { /* Don't allow people to specify paths for modules, it doesn't work as expected */ @@ -126,29 +122,29 @@ bool ModuleManager::Load(const std::string& modname, bool defer) /* We must load the modules AFTER initializing the socket engine, now */ void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicemap) { - std::cout << std::endl << "Loading core commands" << std::flush; + std::cout << "Loading core modules " << std::flush; - DIR* library = opendir(ServerInstance->Config->Paths.Module.c_str()); - if (library) + std::vector<std::string> files; + if (!FileSystem::GetFileList(ServerInstance->Config->Paths.Module, files, "core_*.so")) { - dirent* entry = NULL; - while (0 != (entry = readdir(library))) - { - if (InspIRCd::Match(entry->d_name, "core_*.so", ascii_case_insensitive_map)) - { - std::cout << "." << std::flush; + std::cout << "failed!" << std::endl; + ServerInstance->Exit(EXIT_STATUS_MODULE); + } - this->NewServices = &servicemap[entry->d_name]; + for (std::vector<std::string>::const_iterator iter = files.begin(); iter != files.end(); ++iter) + { + std::cout << "." << std::flush; - if (!Load(entry->d_name, true)) - { - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, this->LastError()); - std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl; - ServerInstance->Exit(EXIT_STATUS_MODULE); - } - } + const std::string& name = *iter; + this->NewServices = &servicemap[name]; + + if (!Load(name, true)) + { + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, this->LastError()); + std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl; + ServerInstance->Exit(EXIT_STATUS_MODULE); } - closedir(library); - std::cout << std::endl; } + + std::cout << std::endl; } |
