From ddc2a7fa29033134e185dab1607478c0bb9d3aac Mon Sep 17 00:00:00 2001 From: Seungkeun Lee Date: Mon, 8 Jun 2015 14:29:19 +0900 Subject: [PATCH] Fix ResourceManager::GetLocalizedPath error - return empty string("") when localized resource was not existed. - cache for each locale folder Change-Id: Ia8222c2c9b1e1e99aca575c06a0a81b0133bbf1b --- src/common/resource_manager.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/common/resource_manager.cc b/src/common/resource_manager.cc index 7c36a31..60e42eb 100755 --- a/src/common/resource_manager.cc +++ b/src/common/resource_manager.cc @@ -372,7 +372,13 @@ std::string ResourceManager::GetLocalizedPath(const std::string& origin) { if (!Exists(app_locale_path)) { break; } - std::string resource_path = app_locale_path + locales + "/" + url; + + // check locale path ../locales/en_us/ + std::string app_localized_path = app_locale_path + locales + "/"; + if (!Exists(app_localized_path)) { + continue; + } + std::string resource_path = app_localized_path + url; if (Exists(resource_path)) { result = "file://" + resource_path + suffix; return result; @@ -384,7 +390,8 @@ std::string ResourceManager::GetLocalizedPath(const std::string& origin) { result = "file://" + default_locale + suffix; return result; } - result = url + suffix; + + LOGGER(ERROR) << "URL Localization error"; return result; } -- 2.7.4