summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-08-03 13:37:11 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-08-16 13:52:02 +0000
commit1990ea3677f10bab3dc3cc7b7f8f1c50a399d5d4 (patch)
tree081f0247831b963d137860ba238504c7b06a4b0d
parent258be114062008121a01c0c4cf40abc9b1991189 (diff)
Add path to the installed widget path.
This resolv the link to the binding aftest library then set the dir path to the widget installation location. Depends-On: I5db247fd9925065684e036d8d458c2131006f9db Change-Id: I4c49b930181a813d0ef3c2d873455a4ac7721206 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
m---------app-controller-submodule0
-rw-r--r--src/aft.c26
2 files changed, 21 insertions, 5 deletions
diff --git a/app-controller-submodule b/app-controller-submodule
-Subproject 4e30eb1444fc88b73582db421d3a7467a364706
+Subproject 9ba5c8f531fc371d5402ea28467029bd3e95f98
diff --git a/src/aft.c b/src/aft.c
index df0c69b..0114e8f 100644
--- a/src/aft.c
+++ b/src/aft.c
@@ -191,26 +191,41 @@ static int CtrlCreateApi(AFB_ApiT apiHandle, CtlConfigT *ctrlConfig) {
int afbBindingEntry(afb_api_t apiHandle) {
size_t len = 0, bindingRootDirLen = 0;
- char *dirList;
+ char *dirList, *afTestRootDir, *path;
const char *envDirList = NULL, *configPath = NULL, *bindingRootDir = NULL;
+ json_object *settings = afb_api_settings(apiHandle), *bpath = NULL;
AFB_default = apiHandle;
AFB_ApiDebug(apiHandle, "Controller in afbBindingEntry");
+ if(json_object_object_get_ex(settings, "binding-path", &bpath)) {
+ afTestRootDir = strdup(json_object_get_string(bpath));
+ path = rindex(afTestRootDir, '/');
+ if(strlen(path) < 3)
+ return ERROR;
+ *++path = '.';
+ *++path = '.';
+ *++path = '\0';
+ }
+ else {
+ afTestRootDir = malloc(1);
+ strcpy(afTestRootDir, "");
+ }
+
envDirList = getEnvDirList(CONTROL_PREFIX, "CONFIG_PATH");
bindingRootDir = GetBindingDirPath();
bindingRootDirLen = strlen(bindingRootDir);
if(envDirList) {
- len = strlen(CONTROL_CONFIG_PATH) + strlen(envDirList) + bindingRootDirLen + 2;
+ len = strlen(CONTROL_CONFIG_PATH) + strlen(envDirList) + bindingRootDirLen + 3;
dirList = malloc(len + 1);
- snprintf(dirList, len +1, "%s:%s:%s", envDirList, bindingRootDir, CONTROL_CONFIG_PATH);
+ snprintf(dirList, len +1, "%s:%s:%s:%s", envDirList, afTestRootDir, bindingRootDir, CONTROL_CONFIG_PATH);
}
else {
- len = strlen(CONTROL_CONFIG_PATH) + bindingRootDirLen + 1;
+ len = strlen(CONTROL_CONFIG_PATH) + bindingRootDirLen + 2;
dirList = malloc(len + 1);
- snprintf(dirList, len + 1, "%s:%s", bindingRootDir, CONTROL_CONFIG_PATH);
+ snprintf(dirList, len + 1, "%s:%s:%s", bindingRootDir, afTestRootDir, CONTROL_CONFIG_PATH);
}
configPath = CtlConfigSearch(apiHandle, dirList, CONTROL_PREFIX);
@@ -219,5 +234,6 @@ int afbBindingEntry(afb_api_t apiHandle) {
return ERROR;
}
+ free(afTestRootDir);
return CtrlCreateApi(apiHandle, CtrlLoadConfigFile(apiHandle, configPath));
}