'capi-appfw-package-manager',
'capi-appfw-application',
'capi-system-system-settings',
+ 'libcurl'
],
},
'direct_dependent_settings': {
return find->second;
}
std::string& result = locale_cache_[origin];
+ result = origin;
std::string url = origin;
std::string suffix;
return result;
}
+ std::string file_path = utils::UrlDecode(RemoveLocalePath(url));
for (auto& locales : locale_manager_->system_locales()) {
// check ../locales/
std::string app_locale_path = resource_base_path_ + locale_path;
if (!Exists(app_localized_path)) {
continue;
}
- std::string resource_path = app_localized_path + url;
+ std::string resource_path = app_localized_path + file_path;
if (Exists(resource_path)) {
result = "file://" + resource_path + suffix;
return result;
}
}
- std::string default_locale = resource_base_path_ + url;
+ std::string default_locale = resource_base_path_ + file_path;
if (Exists(default_locale)) {
result = "file://" + default_locale + suffix;
return result;
return result;
}
+std::string ResourceManager::RemoveLocalePath(const std::string& path) {
+ std::string locale_path = "locales/";
+ std::string result_path = path.at(0) == '/' ? path : "/" + path;
+ if (!utils::StartsWith(result_path, resource_base_path_)) {
+ return path;
+ }
+
+ result_path = result_path.substr(resource_base_path_.length());
+ if (!utils::StartsWith(result_path, locale_path)) {
+ return result_path;
+ }
+
+ size_t found = result_path.find_first_of('/', locale_path.length());
+ if (found != std::string::npos) {
+ result_path = result_path.substr(found+1);
+ }
+ return result_path;
+}
+
void ResourceManager::set_base_resource_path(const std::string& path) {
if (path.empty()) {
return;
bool Exists(const std::string& path);
bool CheckWARP(const std::string& url);
bool CheckAllowNavigation(const std::string& url);
+ std::string RemoveLocalePath(const std::string& path);
std::string resource_base_path_;
std::string appid_;
#include <time.h>
#include <math.h>
#include <uuid/uuid.h>
+#include <curl/curl.h>
+
#include <string>
#include <vector>
#include <sstream>
#include <iomanip>
#include <algorithm>
+#include <memory>
+
namespace common {
namespace utils {
+namespace {
+std::unique_ptr<CURL, decltype(curl_easy_cleanup)*>
+ g_curl {nullptr, curl_easy_cleanup};
+} // namespace
+
std::string GenerateUUID() {
char tmp[37];
uuid_t uuid;
return true;
}
+std::string UrlDecode(const std::string& url) {
+ if (g_curl.get() == nullptr) {
+ g_curl.reset(curl_easy_init());
+ }
+ std::unique_ptr<char, decltype(curl_free)*> decoded_str {
+ curl_easy_unescape(g_curl.get(), url.c_str(), url.length(), NULL),
+ curl_free };
+
+ return decoded_str.get() != nullptr ? std::string(decoded_str.get()) : url;
+}
+
+std::string UrlEncode(const std::string& url) {
+ if (g_curl.get() == nullptr) {
+ g_curl.reset(curl_easy_init());
+ }
+ std::unique_ptr<char, decltype(curl_free)*> encoded_str {
+ curl_easy_escape(g_curl.get(), url.c_str(), url.length()),
+ curl_free };
+
+ return encoded_str.get() != nullptr ? std::string(encoded_str.get()) : url;
+}
+
} // namespace utils
} // namespace common
bool SplitString(const std::string &str,
std::string *part_1, std::string *part_2, const char delim);
+std::string UrlEncode(const std::string& url);
+std::string UrlDecode(const std::string& url);
+
} // namespace utils
} // namespace common
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(ecore-wayland)
BuildRequires: pkgconfig(chromium-efl)
+BuildRequires: pkgconfig(libcurl)
%description
Crosswalk Runtime and AppShell for Tizen 3.0 and later