From 3ecc2398eeb1ce275a501965de51e9d4bbe05c32 Mon Sep 17 00:00:00 2001 From: "ky85.kim" Date: Mon, 13 Jul 2015 16:49:02 +0900 Subject: [PATCH] Change config directory for multi-client Change-Id: Ic87b38047e2957fd46ed29085193a233c6a8e75a --- changelog | 1 + common/vc_config_parser.c | 13 +++++++++++++ common/vc_defs.h | 22 ++++++++++++---------- packaging/voice-control.spec | 4 +--- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/changelog b/changelog index 62b7c06..7c80c65 100644 --- 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 ) * Add daemon activation by dbus (Kwangyoun Kim ) + * Change config directory for multi-client (Kwnagyoun Kim ) vc (0.2.7) -- Wed, 21 Jan 2015 diff --git a/common/vc_config_parser.c b/common/vc_config_parser.c index 7dd47e3..881843f 100644 --- a/common/vc_config_parser.c +++ b/common/vc_config_parser.c @@ -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) { diff --git a/common/vc_defs.h b/common/vc_defs.h index 7c88337..a9ee25e 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -18,11 +18,12 @@ #ifndef __VC_DEFS_H__ #define __VC_DEFS_H__ +#include + #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 diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index dab629a..70d7160 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -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 -- 2.7.4