From 8de9a8a9b5a387310c436dfc3b63cc4ab4e72ba0 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Thu, 6 Oct 2016 09:30:19 +0900 Subject: [PATCH] Fix the path convert issue Change-Id: Idff8dae8865968f56e53fffc941741c1f8abdd09 Signed-off-by: jaekuk, lee --- packaging/download-provider.spec | 2 +- provider-interface/CMakeLists.txt | 2 +- provider-interface/download-provider-interface.c | 54 ++++++++++++++++++++++-- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/packaging/download-provider.spec b/packaging/download-provider.spec index 1462384..e00959b 100755 --- a/packaging/download-provider.spec +++ b/packaging/download-provider.spec @@ -1,7 +1,7 @@ %define _ux_define tizen2.3 Name: download-provider Summary: Download the contents in background -Version: 2.1.64 +Version: 2.1.65 Release: 0 Group: Development/Libraries License: Apache-2.0 diff --git a/provider-interface/CMakeLists.txt b/provider-interface/CMakeLists.txt index 70792e7..0b44f58 100755 --- a/provider-interface/CMakeLists.txt +++ b/provider-interface/CMakeLists.txt @@ -8,7 +8,7 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") -SET(PC_REQUIRED "glib-2.0 gobject-2.0 dlog capi-base-common capi-appfw-app-manager capi-appfw-application bundle") +SET(PC_REQUIRED "glib-2.0 gobject-2.0 dlog capi-base-common capi-appfw-app-manager capi-appfw-application bundle storage") INCLUDE(FindPkgConfig) diff --git a/provider-interface/download-provider-interface.c b/provider-interface/download-provider-interface.c index b157259..c25be8e 100755 --- a/provider-interface/download-provider-interface.c +++ b/provider-interface/download-provider-interface.c @@ -44,6 +44,7 @@ #ifdef SUPPORT_CHECK_IPC #include #endif +#include #define DP_CHECK_CONNECTION do {\ int dp_errorcode = __check_connections();\ @@ -60,6 +61,8 @@ }\ } while(0) +#define DOWNLOAD_FILENAME_MAX 256 + // define type typedef struct { int channel; // query & response @@ -819,14 +822,32 @@ int dp_interface_get_url(const int id, char **url) int dp_interface_set_destination(const int id, const char *path) { + char set_filename[DOWNLOAD_FILENAME_MAX] = {0, }; + if (path == NULL) return __dp_ipc_echo(id, DP_SEC_UNSET, DP_PROP_DESTINATION, __FUNCTION__); + + if (storage_get_origin_internal_path(path, DOWNLOAD_FILENAME_MAX, set_filename) == 0) { + /* Converted. Use converted path. */ + TRACE_ERROR("Converted filename : %s -> %s", path, set_filename); + return __dp_ipc_set_string(id, DP_SEC_SET, DP_PROP_DESTINATION, set_filename, __FUNCTION__); + } return __dp_ipc_set_string(id, DP_SEC_SET, DP_PROP_DESTINATION, path, __FUNCTION__); } int dp_interface_get_destination(const int id, char **path) { - return __dp_ipc_get_string(id, DP_PROP_DESTINATION, path, __FUNCTION__); + char compat_filename[DOWNLOAD_FILENAME_MAX] = {0, }; + int ret = 0; + + ret = __dp_ipc_get_string(id, DP_PROP_DESTINATION, path, __FUNCTION__); + + if (storage_get_compat_internal_path(*path, DOWNLOAD_FILENAME_MAX, compat_filename) == 0) { + /* Converted. Use converted path. */ + TRACE_ERROR("Converted filename : %s -> %s", *path, compat_filename); + *path = strdup(compat_filename); + } + return ret; } int dp_interface_set_file_name(const int id, const char *file_name) @@ -843,12 +864,32 @@ int dp_interface_get_file_name(const int id, char **file_name) int dp_interface_get_downloaded_file_path(const int id, char **path) { - return __dp_ipc_get_string(id, DP_PROP_SAVED_PATH, path, __FUNCTION__); + char compat_filename[DOWNLOAD_FILENAME_MAX] = {0, }; + int ret = 0; + + ret = __dp_ipc_get_string(id, DP_PROP_SAVED_PATH, path, __FUNCTION__); + + if (storage_get_compat_internal_path(*path, DOWNLOAD_FILENAME_MAX, compat_filename) == 0) { + /* Converted. Use converted path. */ + TRACE_ERROR("Converted filename : %s -> %s", *path, compat_filename); + *path = strdup(compat_filename); + } + return ret; } int dp_interface_get_temp_path(const int id, char **temp_path) { - return __dp_ipc_get_string(id, DP_PROP_TEMP_SAVED_PATH, temp_path, __FUNCTION__); + char compat_filename[DOWNLOAD_FILENAME_MAX] = {0, }; + int ret = 0; + + ret = __dp_ipc_get_string(id, DP_PROP_TEMP_SAVED_PATH, temp_path, __FUNCTION__); + + if (storage_get_compat_internal_path(*temp_path, DOWNLOAD_FILENAME_MAX, compat_filename) == 0) { + /* Converted. Use converted path. */ + TRACE_ERROR("Converted filename : %s -> %s", *temp_path, compat_filename); + *temp_path = strdup(compat_filename); + } + return ret; } int dp_interface_get_content_name(const int id, char **content_name) @@ -863,6 +904,13 @@ int dp_interface_get_etag(const int id, char **etag) int dp_interface_set_temp_file_path(const int id, const char *path) { + char set_filename[DOWNLOAD_FILENAME_MAX] = {0, }; + + if (storage_get_origin_internal_path(path, DOWNLOAD_FILENAME_MAX, set_filename) == 0) { + /* Converted. Use converted path. */ + TRACE_ERROR("Converted filename : %s -> %s", path, set_filename); + return __dp_ipc_set_string(id, DP_SEC_SET, DP_PROP_TEMP_SAVED_PATH, set_filename, __FUNCTION__); + } return __dp_ipc_set_string(id, DP_SEC_SET, DP_PROP_TEMP_SAVED_PATH, path, __FUNCTION__); } -- 2.7.4