From: Hwankyu Jhun Date: Tue, 24 Apr 2018 08:38:55 +0000 (+0900) Subject: Add an exception handling X-Git-Tag: accepted/tizen/unified/20180425.062323~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45d58230e546450063a537e0cd176e49a6ce7bf1;p=platform%2Fcore%2Fappfw%2Faul-1.git Add an exception handling - Verify current language before getting cached information Change-Id: I0a41e9f2a8e468b7310ab7034a88442ac005c7fe Signed-off-by: Hwankyu Jhun --- diff --git a/src/aul_rsc_mgr.c b/src/aul_rsc_mgr.c index a43675c..b09c1f0 100755 --- a/src/aul_rsc_mgr.c +++ b/src/aul_rsc_mgr.c @@ -720,6 +720,12 @@ static int __close(resource_manager_t *handle) static void __vconf_cb(keynode_t *key, void *data) { + char *val; + + val = vconf_keynode_get_str(key); + if (val && cur_language && !strcmp(val, cur_language)) + return; + __invalidate_cache(); } @@ -1051,6 +1057,24 @@ API int aul_resource_manager_get_path_list(GHashTable **list) return AUL_RESOURCE_ERROR_NONE; } +static bool __verify_current_language(void) +{ + char *lang; + + lang = vconf_get_str(VCONFKEY_LANGSET); + if (!lang) + return false; + + if (cur_language && !strcmp(lang, cur_language)) { + free(lang); + return true; + } + + free(lang); + + return false; +} + API int aul_resource_manager_get(aul_resource_e type, const char *id, char **path) { int retval = AUL_RESOURCE_ERROR_NONE; @@ -1081,11 +1105,15 @@ API int aul_resource_manager_get(aul_resource_e type, const char *id, char **pat return retval; } - /* To get fname from cache */ - cached_path = __get_cache(type, id); - if (cached_path != NULL) { - *path = strdup(cached_path); - return AUL_RESOURCE_ERROR_NONE; + if (__verify_current_language()) { + /* To get fname from cache */ + cached_path = __get_cache(type, id); + if (cached_path != NULL) { + *path = strdup(cached_path); + return AUL_RESOURCE_ERROR_NONE; + } + } else { + __invalidate_cache(); } }