Fix getting locale resource path 26/74326/9 accepted/tizen/common/20160615.193258 accepted/tizen/ivi/20160615.001459 accepted/tizen/mobile/20160615.001624 accepted/tizen/tv/20160615.001537 accepted/tizen/wearable/20160615.001551 submit/tizen/20160614.094055
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 14 Jun 2016 01:29:46 +0000 (10:29 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 14 Jun 2016 06:54:48 +0000 (15:54 +0900)
Change-Id: Ib402f78b3ab0dc5800a8a1e0d8ed9ef795d6ae7c
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
CMakeLists.txt
packaging/app-core.spec
src/appcore.c

index 81d9fd8b4fde0f692b0f6c638fd47e7c1f51ef90..9e357fdd8b9fc1d8cef476cde4485e0cabdad6f8 100644 (file)
@@ -42,7 +42,7 @@ ENDIF(_APPFW_FEATURE_BACKGROUND_MANAGEMENT)
 SET(HEADERS_common appcore-common.h)
 
 INCLUDE(FindPkgConfig)
-SET(APPCORE_PKG_CHECK_MODULES "gio-2.0 vconf sensor aul dlog libtzplatform-config ecore")
+SET(APPCORE_PKG_CHECK_MODULES "gio-2.0 vconf sensor aul dlog ecore")
 IF(_WITH_X11)
        SET(APPCORE_PKG_CHECK_MODULES "${APPCORE_PKG_CHECK_MODULES} x11 eina ecore-x")
 ENDIF(_WITH_X11)
index 9884a3db85366fee89c788e34c3fc2da71f095f6..d5f2513fe4a5a0889aecdfdf0b666d0235d03e62 100644 (file)
@@ -31,7 +31,6 @@ BuildRequires:  pkgconfig(elementary)
 BuildRequires:  pkgconfig(ecore)
 BuildRequires:  pkgconfig(gobject-2.0)
 BuildRequires:  pkgconfig(glib-2.0)
-BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  pkgconfig(ttrace)
 BuildRequires:  cmake
index fd4fca649e361ed7e813d5ab1673a190ff2675ee..4e479989b747dd7998bd8aa4483e15f0b25b8c17 100644 (file)
@@ -30,7 +30,6 @@
 #include <dlfcn.h>
 #include <vconf.h>
 #include <aul.h>
-#include <tzplatform_config.h>
 #include <bundle_internal.h>
 #include "appcore-internal.h"
 
 
 #define SQLITE_FLUSH_MAX               (1024*1024)
 
-#define PKGNAME_MAX 256
-#define PATH_APP_ROOT tzplatform_getenv(TZ_USER_APP)
-#define PATH_SYS_RO_APP_ROOT tzplatform_getenv(TZ_SYS_RO_APP)
-#define PATH_SYS_RW_APP_ROOT tzplatform_getenv(TZ_SYS_RW_APP)
-#define PATH_RES "/res"
-#define PATH_LOCALE "/locale"
+#define PATH_LOCALE "locale"
 
 static struct appcore core;
 static pid_t _pid;
@@ -146,34 +140,18 @@ static GDBusConnection *bus = NULL;
 static guint __suspend_dbus_handler_initialized = 0;
 #endif
 
-static int __get_dir_name(char *dirname)
+static int __get_locale_resource_dir(char *locale_dir, int size)
 {
-       char pkg_name[PKGNAME_MAX];
-       int r;
-       int pid;
-
-       pid = getpid();
-       if (pid < 0)
-               return -1;
+       const char *res_path;
 
-       if (aul_app_get_pkgname_bypid(pid, pkg_name, PKGNAME_MAX) != AUL_R_OK)
+       res_path = aul_get_app_resource_path();
+       if (res_path == NULL) {
+               _ERR("Failed to get resource path");
                return -1;
+       }
 
-       r = snprintf(dirname, PATH_MAX, "%s/%s" PATH_RES PATH_LOCALE,
-                       PATH_APP_ROOT, pkg_name);
-       if (r < 0)
-               return -1;
-       if (access(dirname, R_OK) == 0)
-               return 0;
-       r = snprintf(dirname, PATH_MAX, "%s/%s" PATH_RES PATH_LOCALE,
-                       PATH_SYS_RO_APP_ROOT, pkg_name);
-       if (r < 0)
-               return -1;
-       if (access(dirname, R_OK) == 0)
-               return 0;
-       r = snprintf(dirname, PATH_MAX, "%s/%s" PATH_RES PATH_LOCALE,
-                       PATH_SYS_RW_APP_ROOT, pkg_name);
-       if (r < 0)
+       snprintf(locale_dir, size, "%s" PATH_LOCALE, res_path);
+       if (access(locale_dir, R_OK) != 0)
                return -1;
 
        return 0;
@@ -692,7 +670,7 @@ EXPORT_API int appcore_init(const char *name, const struct ui_ops *ops,
                            int argc, char **argv)
 {
        int r;
-       char dirname[PATH_MAX];
+       char locale_dir[PATH_MAX];
 
        if (core.state != 0) {
                _ERR("Already in use");
@@ -706,8 +684,8 @@ EXPORT_API int appcore_init(const char *name, const struct ui_ops *ops,
                return -1;
        }
 
-       r = __get_dir_name(dirname);
-       r = set_i18n(name, dirname);
+       r = __get_locale_resource_dir(locale_dir, sizeof(locale_dir));
+       r = set_i18n(name, locale_dir);
        _retv_if(r == -1, -1);
 
        r = aul_launch_init(__aul_handler, &core);