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 e05184c3f347f8389e477a5fa41519ab10fda31b..1ce05ad9698c1ceb77cd9cd7d3ffa75c02b8ee54 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 795a642fafb86e70876881f9b5a18407ead7e10e..c3a6a1577a5b143224d004fb461b1f16e44d6e07 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 ff6ce4c845604f933f5404e726b1e48eeff34ae4..14b043c2fb3a93842995a644a542beb8a39ebc20 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 81f4f5e7d396c8f3d019fe3b1c1a87ebd5928075..1b58f720d07617d0ad824d0f199772e12f66c266 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 a3c2da53fa5b146f11206c47cbb132456193cc3c..cadcee82c0231b1fd09222fe76ee97da6b4cd6d7 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 9698630c98df8dd8746df10548c65775f183dab2..ef59f29c0d698f482f4395854d159c9841af4da6 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()
 {