diff options
-rw-r--r-- | conf.d/cmake/config.cmake | 4 | ||||
-rw-r--r-- | signal-composer-binding/signal-composer-binding.cpp | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake index 2a09704..5e0acfb 100644 --- a/conf.d/cmake/config.cmake +++ b/conf.d/cmake/config.cmake @@ -129,8 +129,8 @@ list(APPEND link_libraries afb-helpers) # CACHE STRING "Compilation flags for RELEASE build type.") set(CONTROL_SUPPORT_LUA 1) -add_definitions(-DCONTROL_PLUGIN_PATH="${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/lib/plugins:${CMAKE_BINARY_DIR}/package/lib/plugins:${CMAKE_BINARY_DIR}/package/var") -add_definitions(-DCONTROL_CONFIG_PATH="${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/etc:${CMAKE_BINARY_DIR}/package/etc") +add_definitions(-DCONTROL_PLUGIN_PATH="${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/lib/plugins:${CMAKE_BINARY_DIR}/package/lib/plugins:${CMAKE_BINARY_DIR}/package/var:${CMAKE_BINARY_DIR}/package-test") +add_definitions(-DCONTROL_CONFIG_PATH="${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/etc:${CMAKE_BINARY_DIR}/package/etc:${CMAKE_BINARY_DIR}/package-test/") add_definitions(-DCTL_PLUGIN_MAGIC=1286576532) add_definitions(-DAFB_BINDING_VERSION=2) diff --git a/signal-composer-binding/signal-composer-binding.cpp b/signal-composer-binding/signal-composer-binding.cpp index 234888c..5932640 100644 --- a/signal-composer-binding/signal-composer-binding.cpp +++ b/signal-composer-binding/signal-composer-binding.cpp @@ -178,9 +178,16 @@ void addObjects(afb_req request) if(filepath) { objectsJ = json_object_from_file(filepath); - if(!objectsJ) + if(! objectsJ) { - json_object* responseJ = ScanForConfig(CONTROL_CONFIG_PATH, CTL_SCAN_RECURSIVE, filepath, ".json"); + const char *has_slash = strrchr(filepath, '/'); + char *filename = has_slash ? strdupa(has_slash + 1) : strdupa(filepath); + char *filename_end = strrchr(filename, '.'); + if (filename_end) + {*filename_end = '\0';} + + json_object* responseJ = ScanForConfig(CONTROL_CONFIG_PATH, CTL_SCAN_RECURSIVE, filename, ".json"); + if(responseJ) { filepath = ConfigSearch(nullptr, responseJ); |