diff options
author | 2017-12-19 16:26:34 +0100 | |
---|---|---|
committer | 2017-12-19 16:36:30 +0100 | |
commit | 554b5ec5cbe4520abfee59ac0963af7ac1ecfadd (patch) | |
tree | 0921334b68e3894360d90f7f72235afbe8c0f235 /ctl-lib/ctl-plugin.c | |
parent | ceddbcb12d9fa3e8f0e2f71fd098db78aec4acb9 (diff) |
Add binding rootdir to searched path for conf and plugins
Change-Id: I4526dd9afc76ac9c63ecb6e800157a0678485955
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-plugin.c')
-rw-r--r-- | ctl-lib/ctl-plugin.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c index 5677f91..705a2b4 100644 --- a/ctl-lib/ctl-plugin.c +++ b/ctl-lib/ctl-plugin.c @@ -108,7 +108,19 @@ STATIC int PluginLoadOne (AFB_ApiT apiHandle, CtlPluginT *ctlPlugin, json_object if (!basename) basename=ctlPlugin->uid; // if search path not in Json config file, then try default - if (!ldSearchPath) ldSearchPath = CONTROL_PLUGIN_PATH; + if (!ldSearchPath) + { + char path[CONTROL_MAXPATH_LEN]; + memset(path, 0, sizeof(path)); + const char *envpath = getenv("CONTROL_PLUGIN_PATH"); + envpath ? + strncat(path, envpath, strlen(envpath)): + strncat(path, CONTROL_PLUGIN_PATH, strlen(CONTROL_PLUGIN_PATH)); + const char *bPath = GetBindingDirPath(); + strncat(path, ":", strlen(":")); + strncat(path, bPath, strlen(bPath)); + ldSearchPath = path; + } // search for default policy config file pluginPathJ = ScanForConfig(ldSearchPath, CTL_SCAN_RECURSIVE, basename, CTL_PLUGIN_EXT); |