From c92cec0e876d638b91eb64e12e306e9a29ed2e8f Mon Sep 17 00:00:00 2001 From: Jiwoong Im Date: Mon, 17 Mar 2014 15:10:40 +0900 Subject: [PATCH] Add multi-user support Bug-Tizen: PTREL-258 Change-Id: If4d974a2b064fcebd7b5cece39a60e97e324b6b4 Signed-off-by: Jiwoong Im --- CMakeLists.txt | 2 +- include/app_private.h | 15 ++++++++------- packaging/capi-appfw-application.spec | 1 + src/app_main.c | 6 ++++-- src/app_resource.c | 7 +++++-- src/storage_internal.c | 4 +++- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e05184c..1ce05ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -SET(requires "dlog bundle appcore-common appcore-efl aul ail appsvc notification elementary capi-base-common alarm-service sqlite3") +SET(requires "dlog bundle appcore-common appcore-efl aul ail appsvc notification elementary capi-base-common alarm-service sqlite3 libtzplatform-config") SET(pc_requires "capi-base-common") INCLUDE(FindPkgConfig) diff --git a/include/app_private.h b/include/app_private.h index 795a642..c3a6a15 100755 --- a/include/app_private.h +++ b/include/app_private.h @@ -19,6 +19,7 @@ #define __TIZEN_APPFW_APP_PRIVATE_H__ #include +#include // GNU gettext macro is already defined at appcore-common.h #ifdef _ @@ -33,14 +34,14 @@ extern "C" { #define TIZEN_PATH_MAX 1024 -#define PATH_FMT_APP_ROOT "/opt/usr/apps" -#define PATH_FMT_RES_DIR PATH_FMT_APP_ROOT "/%s/res" -#define PATH_FMT_LOCALE_DIR PATH_FMT_RES_DIR "/locale" -#define PATH_FMT_DATA_DIR PATH_FMT_APP_ROOT "/%s/data" +#define PATH_FMT_APP_ROOT tzplatform_getenv(TZ_USER_APP) +#define PATH_FMT_RES_DIR "/res" +#define PATH_FMT_LOCALE_DIR "/locale" +#define PATH_FMT_DATA_DIR "/data" -#define PATH_FMT_RO_APP_ROOT "/usr/apps" -#define PATH_FMT_RO_RES_DIR PATH_FMT_RO_APP_ROOT "/%s/res" -#define PATH_FMT_RO_LOCALE_DIR PATH_FMT_RO_RES_DIR "/locale" +#define PATH_FMT_RO_APP_ROOT tzplatform_getenv(TZ_SYS_RO_APP) +#define PATH_FMT_RO_RES_DIR "/res" +#define PATH_FMT_RO_LOCALE_DIR "/local" typedef void (*app_finalizer_cb) (void *data); diff --git a/packaging/capi-appfw-application.spec b/packaging/capi-appfw-application.spec index ff6ce4c..14b043c 100755 --- a/packaging/capi-appfw-application.spec +++ b/packaging/capi-appfw-application.spec @@ -19,6 +19,7 @@ BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(alarm-service) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(sqlite3) +BuildRequires: pkgconfig(libtzplatform-config) diff --git a/src/app_main.c b/src/app_main.c index 81f4f5e..1b58f72 100755 --- a/src/app_main.c +++ b/src/app_main.c @@ -146,9 +146,11 @@ int app_appcore_create(void *data) app_set_appcore_event_cb(app_context); - snprintf(locale_dir, TIZEN_PATH_MAX, PATH_FMT_LOCALE_DIR, app_context->package); + snprintf(locale_dir, TIZEN_PATH_MAX, "%s/%s" PATH_FMT_RES_DIR + PATH_FMT_LOCALE_DIR, PATH_FMT_APP_ROOT, app_context->package); if (access(locale_dir, R_OK) != 0) { - snprintf(locale_dir, TIZEN_PATH_MAX, PATH_FMT_RO_LOCALE_DIR, app_context->package); + snprintf(locale_dir, TIZEN_PATH_MAX, "%s/%s" PATH_FMT_RO_RES_DIR + PATH_FMT_RO_LOCALE_DIR, PATH_FMT_RO_APP_ROOT, app_context->package); } appcore_set_i18n(app_context->app_name, locale_dir); diff --git a/src/app_resource.c b/src/app_resource.c index a3c2da5..cadcee8 100755 --- a/src/app_resource.c +++ b/src/app_resource.c @@ -33,14 +33,17 @@ #include #include +#include + #ifdef LOG_TAG #undef LOG_TAG #endif #define LOG_TAG "CAPI_APPFW_APPLICATION" -static const char *INSTALLED_PATH = "/opt/usr/apps"; -static const char *RO_INSTALLED_PATH = "/usr/apps"; +#define INSTALLED_PATH tzplatform_getenv(TZ_USER_APP) +#define RO_INSTALLED_PATH tzplatform_getenv(TZ_SYS_RO_APP) + static const char *RES_DIRECTORY_NAME = "res"; static const char *DATA_DIRECTORY_NAME = "data"; diff --git a/src/storage_internal.c b/src/storage_internal.c index 9698630..ef59f29 100755 --- a/src/storage_internal.c +++ b/src/storage_internal.c @@ -27,13 +27,15 @@ #include #include +#include + #ifdef LOG_TAG #undef LOG_TAG #endif #define LOG_TAG "CAPI_APPFW_APPLICATION_STORAGE" -#define INTERNAL_MEMORY_PATH "/opt/usr/media" +#define INTERNAL_MEMORY_PATH tzplatform_getenv(TZ_USER_CONTENT) int storage_internal_get_state() { -- 2.7.4