From a53b10be804cea996e4a59315e48dc4e2dcb0e4c Mon Sep 17 00:00:00 2001 From: =?utf8?q?K=C3=A9vin=20THIERRY?= Date: Mon, 27 Jan 2014 16:41:10 +0100 Subject: [PATCH] Add multi-user support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit /opt/usr/voice/ purpose was to stock user's downloaded engines and associated settings. It has been moved to ~/.voice/ to respect the multi-user architecture. Also set valid group tags. Bug-Tizen: PTREL-292 Change-Id: Ib0f8679733b950a76e3e5ddef69568c029c6e805 Signed-off-by: Kévin THIERRY --- CMakeLists.txt | 2 +- packaging/stt.spec | 14 +++++++------- server/sttd_config.c | 6 +++++- server/sttd_engine_agent.c | 2 +- server/sttd_main.h | 9 ++++++--- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d1532e..35c7f5d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/common") ## Dependent packages ## INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED - glib-2.0 dbus-1 vconf dlog ecore ecore-file capi-media-audio-io capi-media-sound-manager + glib-2.0 dbus-1 vconf dlog ecore ecore-file capi-media-audio-io capi-media-sound-manager libtzplatform-config ) ## Client library ## diff --git a/packaging/stt.spec b/packaging/stt.spec index 04d8cec..ccb224a 100755 --- a/packaging/stt.spec +++ b/packaging/stt.spec @@ -1,12 +1,12 @@ Name: stt Summary: Speech To Text client library and daemon Version: 0.1.41 -Release: 1 -Group: UI Framework/Libraries +Release: 0 +Group: Graphics & UI Framework/Libraries License: Apache-2.0 Source0: %{name}-%{version}.tar.gz -Source1001: %{name}.manifest -Source1002: %{name}-devel.manifest +Source1001: %{name}.manifest +Source1002: %{name}-devel.manifest BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(ecore) @@ -15,7 +15,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(capi-media-audio-io) BuildRequires: pkgconfig(capi-media-sound-manager) - +BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: cmake %description @@ -24,7 +24,7 @@ Speech To Text client library and daemon. %package devel Summary: Speech To Text header files for STT development -Group: Development/UI Framework +Group: Graphics & UI Framework/Development Requires: %{name} = %{version}-%{release} %description devel @@ -51,7 +51,7 @@ rm -rf %{buildroot} %files %manifest %{name}.manifest %license LICENSE.APLv2 -/etc/config/sysinfo-stt.xml +%config %{_sysconfdir}/config/sysinfo-stt.xml %defattr(-,root,root,-) %{_libdir}/libstt.so %{_libdir}/libstt_setting.so diff --git a/server/sttd_config.c b/server/sttd_config.c index 377ae29..4632c3c 100644 --- a/server/sttd_config.c +++ b/server/sttd_config.c @@ -12,11 +12,15 @@ */ #include + +/* For multi-user support */ +#include + #include "sttd_main.h" #include "sttd_config.h" -#define CONFIG_FILE_PATH CONFIG_DIRECTORY"/sttd.conf" +#define CONFIG_FILE_PATH tzplatform_mkpath(TZ_USER_HOME, ".voice/sttd.conf") #define CONFIG_DEFAULT BASE_DIRECTORY_DEFAULT"/sttd.conf" #define ENGINE_ID "ENGINE_ID" diff --git a/server/sttd_engine_agent.c b/server/sttd_engine_agent.c index acd1ef6..cba5e96 100644 --- a/server/sttd_engine_agent.c +++ b/server/sttd_engine_agent.c @@ -513,7 +513,7 @@ int __internal_update_engine_list() strncat(filepath, dirp->d_name, strlen(dirp->d_name) ); } else { SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Memory not enough!!" ); - continue; + continue; } /* get its info and update engine list */ diff --git a/server/sttd_main.h b/server/sttd_main.h index 3245197..0ce3bd9 100644 --- a/server/sttd_main.h +++ b/server/sttd_main.h @@ -24,6 +24,9 @@ #include #include +/* For multi-user support */ +#include + #ifdef __cplusplus extern "C" { #endif @@ -38,10 +41,10 @@ extern "C" { #define ENGINE_DIRECTORY_DEFAULT "/usr/lib/voice/stt/1.0/engine" #define ENGINE_DIRECTORY_DEFAULT_SETTING "/usr/lib/voice/stt/1.0/setting" -#define CONFIG_DIRECTORY "/opt/home/app/.voice" +#define CONFIG_DIRECTORY tzplatform_mkpath(TZ_USER_HOME, ".voice") -#define ENGINE_DIRECTORY_DOWNLOAD "/opt/usr/voice/stt/1.0/engine" -#define ENGINE_DIRECTORY_DOWNLOAD_SETTING "/opt/usr/voice/stt/1.0/setting" +#define ENGINE_DIRECTORY_DOWNLOAD tzplatform_mkpath(TZ_USER_HOME, ".voice/stt/1.0/engine") +#define ENGINE_DIRECTORY_DOWNLOAD_SETTING tzplatform_mkpath(TZ_USER_HOME, ".voice/stt/1.0/setting") /* for debug message */ #define RECORDER_DEBUG -- 2.7.4