MCPcopy Create free account
hub / github.com/ElementsProject/lightning / add_plugin_dir

Function add_plugin_dir

lightningd/plugin.c:1620–1654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1618}
1619
1620char *add_plugin_dir(struct plugins *plugins, const char *dir, bool error_ok)
1621{
1622 struct dirent *di;
1623 DIR *d = opendir(dir);
1624 struct plugin *p;
1625
1626 if (!d) {
1627 if (!error_ok && errno == ENOENT)
1628 return NULL;
1629 return tal_fmt(NULL, "Failed to open plugin-dir %s: %s",
1630 dir, strerror(errno));
1631 }
1632
1633 while ((di = readdir(d)) != NULL) {
1634 const char *fullpath;
1635
1636 if (streq(di->d_name, ".") || streq(di->d_name, ".."))
1637 continue;
1638 fullpath = plugin_fullpath(tmpctx, dir, di->d_name);
1639 if (!fullpath)
1640 continue;
1641 if (plugin_blacklisted(plugins, fullpath)) {
1642 log_info(plugins->log, "%s: disabled via disable-plugin",
1643 fullpath);
1644 } else {
1645 p = plugin_register(plugins, fullpath, NULL, false,
1646 NULL, NULL);
1647 if (!p && !error_ok)
1648 return tal_fmt(NULL, "Failed to register %s: %s",
1649 fullpath, strerror(errno));
1650 }
1651 }
1652 closedir(d);
1653 return NULL;
1654}
1655
1656void clear_plugins(struct plugins *plugins)
1657{

Callers 3

opt_add_plugin_dirFunction · 0.85
plugins_add_default_dirFunction · 0.85
plugin_dynamic_startdirFunction · 0.85

Calls 4

plugin_fullpathFunction · 0.85
plugin_blacklistedFunction · 0.85
log_infoClass · 0.85
plugin_registerFunction · 0.85

Tested by

no test coverage detected