Add multi-user support
authorJiwoong Im <jiwoong.im@samsung.com>
Mon, 17 Mar 2014 06:10:40 +0000 (15:10 +0900)
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Tue, 18 Mar 2014 08:29:06 +0000 (01:29 -0700)
Bug-Tizen: PTREL-258
Change-Id: If4d974a2b064fcebd7b5cece39a60e97e324b6b4
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
CMakeLists.txt
include/app_private.h
packaging/capi-appfw-application.spec
src/app_main.c
src/app_resource.c
src/storage_internal.c

index e05184c..1ce05ad 100644 (file)
@@ -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)
index 795a642..c3a6a15 100755 (executable)
@@ -19,6 +19,7 @@
 #define __TIZEN_APPFW_APP_PRIVATE_H__
 
 #include <appcore-common.h>
+#include <tzplatform_config.h>
 
 // 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);
 
index ff6ce4c..14b043c 100755 (executable)
@@ -19,6 +19,7 @@ BuildRequires:  pkgconfig(elementary)
 BuildRequires:  pkgconfig(alarm-service)
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(sqlite3)
+BuildRequires:  pkgconfig(libtzplatform-config)
 
 
 
index 81f4f5e..1b58f72 100755 (executable)
@@ -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);
 
index a3c2da5..cadcee8 100755 (executable)
 #include <app_private.h>
 #include <app_service_private.h>
 
+#include <tzplatform_config.h>
+
 #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";
 
index 9698630..ef59f29 100755 (executable)
 #include <app_storage.h>
 #include <app_storage_private.h>
 
+#include <tzplatform_config.h>
+
 #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()
 {