diff --git a/source/w3cipa/w3cipachatgptipaprovider/CMakeLists.txt b/source/w3cipa/w3cipachatgptipaprovider/CMakeLists.txt index 28e08c3..19fdbf2 100644 --- a/source/w3cipa/w3cipachatgptipaprovider/CMakeLists.txt +++ b/source/w3cipa/w3cipachatgptipaprovider/CMakeLists.txt @@ -43,6 +43,15 @@ target_link_libraries(${PROJECT_NAME} w3cipareferenceimplementation) target_link_libraries(${PROJECT_NAME} w3cipaframework) target_include_directories(${PROJECT_NAME} PUBLIC include) +# +# Add configuration files +# +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ChatGPTIPAProvider.json + ${PROJECT_CONFIG_DIR}/ChatGPTIPAProvider.json COPYONLY) + +# +# Installation +# install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ChatGPTIPAProvider.json DESTINATION config) install(TARGETS ${PROJECT_NAME} FILE_SET HEADERS) diff --git a/source/w3cipa/w3cipachatgptipaprovider/src/w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTIPAProvider.cpp b/source/w3cipa/w3cipachatgptipaprovider/src/w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTIPAProvider.cpp index ac8fe9b..59d4182 100644 --- a/source/w3cipa/w3cipachatgptipaprovider/src/w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTIPAProvider.cpp +++ b/source/w3cipa/w3cipachatgptipaprovider/src/w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTIPAProvider.cpp @@ -63,17 +63,18 @@ ChatGPTIPAProvider::ChatGPTIPAProvider() { } void ChatGPTIPAProvider::initialize() { - std::string configFile = "config"; - configFile += std::filesystem::path::preferred_separator; - configFile += "ChatGPTIPAProvider.json"; - if (!std::filesystem::exists(configFile)) { + std::filesystem::path configFile{"config/ChatGPTIPAProvider.json"}; + // Check if the configuration file exists + std::error_code ec; + if (!std::filesystem::exists(configFile, ec)) { LOG4CPLUS_ERROR_FMT( LOGGER, LOG4CPLUS_TEXT( - "ChatGPT IPA provider configuration file %s not found"), - configFile.c_str()); + "ChatGPT IPA provider configuration file %s not found. %s (%d)"), + configFile.c_str(), ec.message().c_str(), ec.value()); return; } + // Parse the configuration file and initialize this provider std::ifstream file(configFile); nlohmann::json json = nlohmann::json::parse(file); ChatGPTConfiguration configuration = json; diff --git a/source/w3cipa/w3cipademo/CMakeLists.txt b/source/w3cipa/w3cipademo/CMakeLists.txt index 76f79d3..1b65e3a 100644 --- a/source/w3cipa/w3cipademo/CMakeLists.txt +++ b/source/w3cipa/w3cipademo/CMakeLists.txt @@ -36,15 +36,17 @@ install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/log4cplus.properties - DESTINATION config) -install(DIRECTORY ${W3CIPA_OPEN_SOURCE_SRC}/bin/ - DESTINATION bin) # # Add configuration files # -set(PROJECT_CONFIG_DIR ${CMAKE_CURRENT_BINARY_DIR}/config) -file(MAKE_DIRECTORY ${PROJECT_CONFIG_DIR}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cplus.properties ${PROJECT_CONFIG_DIR}/log4cplus.properties COPYONLY) + +# +# Installation +# +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/log4cplus.properties + DESTINATION config) +install(DIRECTORY ${W3CIPA_OPEN_SOURCE_SRC}/bin/ + DESTINATION bin)