mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 11:18:51 +02:00
ircd::mods: Improve hiding the module name suffix from public interface.
This commit is contained in:
parent
116b6e12a6
commit
33788e66f2
1 changed files with 9 additions and 11 deletions
20
ircd/mods.cc
20
ircd/mods.cc
|
@ -83,7 +83,7 @@ try
|
||||||
}()}
|
}()}
|
||||||
,_name
|
,_name
|
||||||
{
|
{
|
||||||
handle.location().filename().string()
|
unpostfixed(handle.location().filename().string())
|
||||||
}
|
}
|
||||||
,_location
|
,_location
|
||||||
{
|
{
|
||||||
|
@ -276,11 +276,8 @@ ircd::mods::module::module(const std::string &name)
|
||||||
try
|
try
|
||||||
:std::shared_ptr<mod>{[&name]
|
:std::shared_ptr<mod>{[&name]
|
||||||
{
|
{
|
||||||
const auto path(fullpath(name));
|
|
||||||
const auto filename(postfixed(name));
|
|
||||||
|
|
||||||
// Search for loaded module and increment the reference counter for this handle if loaded.
|
// Search for loaded module and increment the reference counter for this handle if loaded.
|
||||||
auto it(mod::loaded.find(filename));
|
auto it(mod::loaded.find(name));
|
||||||
if(it != end(mod::loaded))
|
if(it != end(mod::loaded))
|
||||||
{
|
{
|
||||||
auto &mod(*it->second);
|
auto &mod(*it->second);
|
||||||
|
@ -293,7 +290,8 @@ try
|
||||||
load_mode::rtld_now
|
load_mode::rtld_now
|
||||||
};
|
};
|
||||||
|
|
||||||
log.debug("Attempting to load '%s' @ `%s'", filename, path.string());
|
const auto path(fullpath(name));
|
||||||
|
log.debug("Attempting to load '%s' @ `%s'", name, path.string());
|
||||||
return std::make_shared<mod>(path, flags);
|
return std::make_shared<mod>(path, flags);
|
||||||
}()}
|
}()}
|
||||||
{
|
{
|
||||||
|
@ -436,7 +434,7 @@ namespace mods {
|
||||||
bool
|
bool
|
||||||
ircd::mods::loaded(const std::string &name)
|
ircd::mods::loaded(const std::string &name)
|
||||||
{
|
{
|
||||||
return mod::loaded.count(postfixed(name));
|
return mod::loaded.count(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -473,11 +471,11 @@ bool
|
||||||
ircd::mods::has_symbol(const std::string &name,
|
ircd::mods::has_symbol(const std::string &name,
|
||||||
const std::string &symbol)
|
const std::string &symbol)
|
||||||
{
|
{
|
||||||
const auto fullpath(search(name));
|
const auto path(fullpath(name));
|
||||||
if(fullpath.empty())
|
if(path.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto syms(symbols(fullpath));
|
const auto syms(symbols(path));
|
||||||
return std::find(begin(syms), end(syms), symbol) != end(syms);
|
return std::find(begin(syms), end(syms), symbol) != end(syms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +528,7 @@ ircd::mods::available()
|
||||||
{
|
{
|
||||||
for(directory_iterator it(dir); it != directory_iterator(); ++it)
|
for(directory_iterator it(dir); it != directory_iterator(); ++it)
|
||||||
if(is_module(it->path(), std::nothrow))
|
if(is_module(it->path(), std::nothrow))
|
||||||
ret.emplace_front(relative(it->path(), dir).string());
|
ret.emplace_front(unpostfixed(relative(it->path(), dir).string()));
|
||||||
}
|
}
|
||||||
catch(const filesystem::filesystem_error &e)
|
catch(const filesystem::filesystem_error &e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue