Fix the path convert issue 99/91099/1 accepted/tizen/3.0/common/20161114.110351 accepted/tizen/3.0/ivi/20161011.043836 accepted/tizen/3.0/mobile/20161015.033159 accepted/tizen/3.0/tv/20161016.004110 accepted/tizen/3.0/wearable/20161015.081941 accepted/tizen/common/20161006.153547 accepted/tizen/ivi/20161006.080046 accepted/tizen/mobile/20161006.080000 accepted/tizen/tv/20161006.080016 accepted/tizen/wearable/20161006.080027 submit/tizen/20161006.005831 submit/tizen_3.0/20161124.012252 submit/tizen_3.0_common/20161104.104000 submit/tizen_3.0_ivi/20161010.000001 submit/tizen_3.0_mobile/20161015.000002 submit/tizen_3.0_tv/20161015.000001 submit/tizen_3.0_wearable/20161015.000001
authorjaekuk, lee <juku1999@samsung.com>
Thu, 6 Oct 2016 00:30:19 +0000 (09:30 +0900)
committerjaekuk, lee <juku1999@samsung.com>
Thu, 6 Oct 2016 00:30:19 +0000 (09:30 +0900)
Change-Id: Idff8dae8865968f56e53fffc941741c1f8abdd09
Signed-off-by: jaekuk, lee <juku1999@samsung.com>
packaging/download-provider.spec
provider-interface/CMakeLists.txt
provider-interface/download-provider-interface.c

index 1462384..e00959b 100755 (executable)
@@ -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
index 70792e7..0b44f58 100755 (executable)
@@ -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)
 
index b157259..c25be8e 100755 (executable)
@@ -44,6 +44,7 @@
 #ifdef SUPPORT_CHECK_IPC
 #include <sys/ioctl.h>
 #endif
+#include <storage-internal.h>
 
 #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__);
 }