Layer configuration file is included in widget 23/11523/6
authorYuta Doi <yuta-d@witz-inc.co.jp>
Tue, 24 Oct 2017 05:09:38 +0000 (14:09 +0900)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Wed, 1 Nov 2017 11:04:49 +0000 (11:04 +0000)
Layer configuration file (layers.json) is placed in target
when installation of windowmanager.

Bug-AGL: SPEC-991

Change-Id: Ia614ec400c185ec7db4379c66321363a68e5e0da
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
CMakeLists.txt
src/CMakeLists.txt
src/config.cpp

index 2d25e73..4ed6d6d 100644 (file)
@@ -80,8 +80,3 @@ set(SANITIZER_MODE "none" CACHE STRING "Build using a specific sanitizer (e.g. '
 set(LINK_LIBCXX OFF CACHE BOOL "Link against LLVMs libc++")
 
 add_subdirectory(src)
-
-install(
-   FILES layers.json
-   DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/windowmanager
-   COMPONENT "runtime")
index 7bbc35d..746fb93 100644 (file)
@@ -122,6 +122,8 @@ endif()
 add_custom_command(TARGET ${TARGETS_WM} POST_BUILD
    COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/lib
    COMMAND cp -rf ${PROJECT_BINARY_DIR}/src/${TARGETS_WM}.so ${PROJECT_BINARY_DIR}/package/root/lib
+   COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/etc
+   COMMAND cp -f ${PROJECT_SOURCE_DIR}/layers.json ${PROJECT_BINARY_DIR}/package/root/etc
 )
 
 add_custom_target(package DEPENDS ${PROJECT_BINARY_DIR}/package/root
index d5a549a..53e014d 100644 (file)
  */
 
 #include "config.hpp"
+#include "hmi-debug.h"
 
 namespace wm {
 
 config::config() : cfg() {
    // Supply default values for these...
-   this->cfg["layers.json"] = getenv("LAYERS_JSON") ?: "/etc/windowmanager/layers.json";
+   char const *path_layers_json = getenv("AFM_APP_INSTALL_DIR");
+
+   if (!path_layers_json) {
+      HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined");
+   }
+   else {
+      this->cfg["layers.json"] = std::string(path_layers_json) + std::string("/etc/layers.json");
+   }
 }
 
 }  // namespace wm