Change config directory for multi-client 84/43684/1 accepted/tizen/mobile/20150714.041139 accepted/tizen/tv/20150714.041149 accepted/tizen/wearable/20150714.041201 submit/tizen/20150714.014611
authorky85.kim <ky85.kim@samsung.com>
Mon, 13 Jul 2015 07:49:02 +0000 (16:49 +0900)
committerky85.kim <ky85.kim@samsung.com>
Mon, 13 Jul 2015 07:49:02 +0000 (16:49 +0900)
Change-Id: Ic87b38047e2957fd46ed29085193a233c6a8e75a

changelog
common/vc_config_parser.c
common/vc_defs.h
packaging/voice-control.spec

index 62b7c06..7c80c65 100644 (file)
--- a/changelog
+++ b/changelog
@@ -2,6 +2,7 @@ voice-control (0.2.8) -- Thu, 18 Jun 2015
 
   * Update IPC and remove volume file (Dongyeol Lee <dy3.lee@samsung.com>)
   * Add daemon activation by dbus (Kwangyoun Kim <ky85.kim@samsung.com>)
+  * Change config directory for multi-client (Kwnagyoun Kim <ky85.kim@samsung.com>)
 
 vc (0.2.7) -- Wed, 21 Jan 2015
 
index 7dd47e3..881843f 100644 (file)
@@ -276,6 +276,19 @@ int vc_parser_load_config(vc_config_s** config_info)
        xmlChar *key;
        bool is_default_open = false;
 
+       if (0 != access(VC_RUNTIME_INFO_ROOT, F_OK)) {
+               SLOG(LOG_DEBUG, vc_config_tag(), "No info root directory");
+               if (0 != access(VC_CONFIG_ROOT, F_OK)) {
+                       SLOG(LOG_DEBUG, vc_config_tag(), "No root directory");
+                       if (0 != mkdir(VC_CONFIG_ROOT, 0755)) {
+                               SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory");
+                       }
+               }
+               if (0 != mkdir(VC_RUNTIME_INFO_ROOT, 0755)) {
+                       SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory");
+               }
+       }
+
        if (0 != access(VC_CONFIG, F_OK)) {
                doc = xmlParseFile(VC_CONFIG_DEFAULT);
                if (doc == NULL) {
index 7c88337..a9ee25e 100644 (file)
 #ifndef __VC_DEFS_H__
 #define __VC_DEFS_H__
 
+#include <tzplatform_config.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 /******************************************************************************************
 * Definition for Dbus
 *******************************************************************************************/
@@ -136,7 +137,7 @@ extern "C" {
 
 #define VC_CONFIG_DEFAULT              "/usr/lib/voice/vc/1.0/vc-config.xml"
 
-#define VC_CONFIG                      "/opt/home/app/.voice/vc-config.xml"
+#define VC_CONFIG                      tzplatform_mkpath(TZ_USER_HOME, ".voice/vc-config.xml")
 
 #define VC_DEFAULT_ENGINE_INFO         "/usr/lib/voice/vc/1.0/engine-info"
 
@@ -146,22 +147,23 @@ extern "C" {
 
 #define VC_RETRY_COUNT         5
 
+#define VC_CONFIG_ROOT                 tzplatform_mkpath(TZ_USER_HOME, ".voice")
 
-#define VC_RUNTIME_INFO_ROOT           "/opt/home/app/.voice/vc"
+#define VC_RUNTIME_INFO_ROOT           tzplatform_mkpath(TZ_USER_HOME, ".voice/vc")
 
-#define VC_RUNTIME_INFO_AUDIO_VOLUME   VC_RUNTIME_INFO_ROOT"/vc_vol"
+#define VC_RUNTIME_INFO_AUDIO_VOLUME   tzplatform_mkpath(TZ_USER_HOME, ".voice/vc/vc_vol")
 
-#define VC_RUNTIME_INFO_FOREGROUND     VC_RUNTIME_INFO_ROOT"/vc-info-foreground.xml"
+#define VC_RUNTIME_INFO_FOREGROUND     tzplatform_mkpath(TZ_USER_HOME, ".voice/vc/vc-info-foreground.xml")
 
-#define VC_RUNTIME_INFO_SERVICE_STATE  VC_RUNTIME_INFO_ROOT"/vc-info-state.xml"
+#define VC_RUNTIME_INFO_SERVICE_STATE  tzplatform_mkpath(TZ_USER_HOME, ".voice/vc/vc-info-state.xml")
 
-#define VC_RUNTIME_INFO_DEMANDABLE_LIST        VC_RUNTIME_INFO_ROOT"/vc-demandable-client.xml"
+#define VC_RUNTIME_INFO_DEMANDABLE_LIST        tzplatform_mkpath(TZ_USER_HOME, ".voice/vc/vc-demandable-client.xml")
 
-#define VC_RUNTIME_INFO_RESULT         VC_RUNTIME_INFO_ROOT"/vc-result.xml"
+#define VC_RUNTIME_INFO_RESULT         tzplatform_mkpath(TZ_USER_HOME, ".voice/vc/vc-result.xml")
 
-#define VC_RUNTIME_INFO_EX_RESULT      VC_RUNTIME_INFO_ROOT"/vc-ex-result.xml"
+#define VC_RUNTIME_INFO_EX_RESULT      tzplatform_mkpath(TZ_USER_HOME, ".voice/vc/vc-ex-result.xml")
 
-#define VC_RUNTIME_INFO_CLIENT         VC_RUNTIME_INFO_ROOT"/vc-client-info.xml"
+#define VC_RUNTIME_INFO_CLIENT         tzplatform_mkpath(TZ_USER_HOME, ".voice/vc/vc-client-info.xml")
 
 
 #ifdef __cplusplus
index dab629a..70d7160 100644 (file)
@@ -20,6 +20,7 @@ BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(ecore)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(libprivilege-control)
+BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  cmake
@@ -98,9 +99,6 @@ install LICENSE %{buildroot}/usr/share/license/%{name}
 
 mkdir -p /usr/share/voice/vc
 
-mkdir -p /opt/home/app/.voice/vc
-chown 5000:5000 /opt/home/app/.voice/vc
-
 %postun -p /sbin/ldconfig
 
 %files