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

Function add_plugin_dir

lightningd/plugin.c:1896–1932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1894}
1895
1896char *add_plugin_dir(struct plugins *plugins, const char *dir, bool error_ok)
1897{
1898 struct dirent *di;
1899 DIR *d = opendir(dir);
1900 struct plugin *p;
1901
1902 if (!d) {
1903 if (!error_ok && errno == ENOENT)
1904 return NULL;
1905 return tal_fmt(tmpctx, "Failed to open plugin-dir %s: %s",
1906 dir, strerror(errno));
1907 }
1908
1909 while ((di = readdir(d)) != NULL) {
1910 const char *fullpath;
1911
1912 if (streq(di->d_name, ".") || streq(di->d_name, ".."))
1913 continue;
1914 fullpath = plugin_fullpath(tmpctx, dir, di->d_name);
1915 if (!fullpath)
1916 continue;
1917 if (plugin_blacklisted(plugins, fullpath)) {
1918 log_info(plugins->log, "%s: disabled via disable-plugin",
1919 fullpath);
1920 } else {
1921 p = plugin_register(plugins, fullpath, NULL, false,
1922 NULL, NULL);
1923 if (!p && !error_ok) {
1924 closedir(d);
1925 return tal_fmt(tmpctx, "Failed to register %s: %s",
1926 fullpath, strerror(errno));
1927 }
1928 }
1929 }
1930 closedir(d);
1931 return NULL;
1932}
1933
1934void clear_plugins(struct plugins *plugins)
1935{

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