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

Function add_plugin_dir

lightningd/plugin.c:1884–1920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1882}
1883
1884char *add_plugin_dir(struct plugins *plugins, const char *dir, bool error_ok)
1885{
1886 struct dirent *di;
1887 DIR *d = opendir(dir);
1888 struct plugin *p;
1889
1890 if (!d) {
1891 if (!error_ok && errno == ENOENT)
1892 return NULL;
1893 return tal_fmt(tmpctx, "Failed to open plugin-dir %s: %s",
1894 dir, strerror(errno));
1895 }
1896
1897 while ((di = readdir(d)) != NULL) {
1898 const char *fullpath;
1899
1900 if (streq(di->d_name, ".") || streq(di->d_name, ".."))
1901 continue;
1902 fullpath = plugin_fullpath(tmpctx, dir, di->d_name);
1903 if (!fullpath)
1904 continue;
1905 if (plugin_blacklisted(plugins, fullpath)) {
1906 log_info(plugins->log, "%s: disabled via disable-plugin",
1907 fullpath);
1908 } else {
1909 p = plugin_register(plugins, fullpath, NULL, false,
1910 NULL, NULL);
1911 if (!p && !error_ok) {
1912 closedir(d);
1913 return tal_fmt(tmpctx, "Failed to register %s: %s",
1914 fullpath, strerror(errno));
1915 }
1916 }
1917 }
1918 closedir(d);
1919 return NULL;
1920}
1921
1922void clear_plugins(struct plugins *plugins)
1923{

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