diff options
author | Sadie Powell <sadie@witchery.services> | 2020-03-27 14:25:09 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2020-03-27 14:25:09 +0000 |
commit | 2ff5d46dc35dd2242d49629f7062ca46ec3ff885 (patch) | |
tree | 3ce01616736e30d4d12284c630363ce50b822b15 | |
parent | 13d6390aeca042cf38565f13664c8dac7d243602 (diff) |
Fix expanding module names.
-rw-r--r-- | src/modules.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 73bd2a5e2..2b83bc0d8 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -622,12 +622,13 @@ ServiceProvider* ModuleManager::FindService(ServiceType type, const std::string& std::string ModuleManager::ExpandModName(const std::string& modname) { - // Transform "callerid" -> "m_callerid.so" unless it already has a ".so" extension, - // so coremods in the "core_*.so" form aren't changed - std::string ret = modname; - if ((modname.length() < 3) || (modname.compare(modname.size() - 3, 3, ".so"))) - ret.insert(0, "m_").append(".so"); - return ret; + std::string fullname; + if (modname.compare(0, 5, "core_") != 0 && modname.compare(0, 2, "m_") != 0) + fullname.append("m_"); + fullname.append(modname); + if (modname.length() < 3 || modname.compare(modname.size() - 3, 3, ".so") != 0) + fullname.append(".so"); + return fullname; } dynamic_reference_base::dynamic_reference_base(Module* Creator, const std::string& Name) |