diff options
author | Hwankyu Jhun <h.jhun@samsung.com> | 2016-06-14 10:29:46 +0900 |
---|---|---|
committer | Hwankyu Jhun <h.jhun@samsung.com> | 2016-06-14 15:54:48 +0900 |
commit | cc9987658a1a65ff530051c9e32134bc3efa74e3 (patch) | |
tree | 497a87b28481e3b81cd57f53f49582425dc4a305 | |
parent | 49d398614817d68434d989990ec7931f67781c26 (diff) | |
download | app-core-cc9987658a1a65ff530051c9e32134bc3efa74e3.tar.gz app-core-cc9987658a1a65ff530051c9e32134bc3efa74e3.tar.bz2 app-core-cc9987658a1a65ff530051c9e32134bc3efa74e3.zip |
Fix getting locale resource pathsubmit/tizen/20160614.094055accepted/tizen/wearable/20160615.001551accepted/tizen/tv/20160615.001537accepted/tizen/mobile/20160615.001624accepted/tizen/ivi/20160615.001459accepted/tizen/common/20160615.193258
Change-Id: Ib402f78b3ab0dc5800a8a1e0d8ed9ef795d6ae7c
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | packaging/app-core.spec | 1 | ||||
-rw-r--r-- | src/appcore.c | 46 |
3 files changed, 13 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 81d9fd8..9e357fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/packaging/app-core.spec b/packaging/app-core.spec index 9884a3d..d5f2513 100644 --- a/packaging/app-core.spec +++ b/packaging/app-core.spec @@ -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 diff --git a/src/appcore.c b/src/appcore.c index fd4fca6..4e47998 100644 --- a/src/appcore.c +++ b/src/appcore.c @@ -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" @@ -44,12 +43,7 @@ #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); |