plugin-loader: Convenience function added to add plugin dirs in build tree
This commit is contained in:
parent
09d0c9030a
commit
8d2450d8b8
|
@ -1170,3 +1170,22 @@ plugin_loader_t *plugin_loader_create()
|
|||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
/*
|
||||
* See header
|
||||
*/
|
||||
void plugin_loader_add_plugindirs(char *basedir, char *plugins)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
char *name, path[PATH_MAX], dir[64];
|
||||
|
||||
enumerator = enumerator_create_token(plugins, " ", "");
|
||||
while (enumerator->enumerate(enumerator, &name))
|
||||
{
|
||||
snprintf(dir, sizeof(dir), "%s", name);
|
||||
translate(dir, "-", "_");
|
||||
snprintf(path, sizeof(path), "%s/%s/.libs", basedir, dir);
|
||||
lib->plugins->add_path(lib->plugins, path);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
|
|
|
@ -146,4 +146,13 @@ struct plugin_loader_t {
|
|||
*/
|
||||
plugin_loader_t *plugin_loader_create();
|
||||
|
||||
/**
|
||||
* Convenience function to add plugin directories for the given plugins within
|
||||
* the given base directory according to the conventions in the src/build tree.
|
||||
*
|
||||
* @param basedir base directory
|
||||
* @param plugins space separated list of plugins
|
||||
*/
|
||||
void plugin_loader_add_plugindirs(char *basedir, char *plugins);
|
||||
|
||||
#endif /** PLUGIN_LOADER_H_ @}*/
|
||||
|
|
Loading…
Reference in New Issue