Get temp path from download daemon 66/201166/1
authorSeonah Moon <seonah1.moon@samsung.com>
Fri, 8 Mar 2019 05:06:56 +0000 (14:06 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Mon, 11 Mar 2019 05:23:42 +0000 (14:23 +0900)
Even if app doesn't set temp path,
temp path is updated when download is started.

Change-Id: Ifd624581ca42dc1fac5c5aa6b96ea3874297e736

packaging/download-provider.spec
provider-interface/download-provider-interface.c

index a85541b..2721a7d 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       download-provider
 Summary:    Download the contents in background
-Version:    2.1.107
+Version:    2.1.108
 Release:    0
 Group:      Development/Libraries
 License:    Apache-2.0
index 323a125..e867b75 100755 (executable)
@@ -920,18 +920,24 @@ int dp_interface_get_downloaded_file_path(const int id, char **path)
 
 int dp_interface_get_temp_path(const int id, char **temp_path)
 {
+       char compat_filename[DOWNLOAD_FILENAME_MAX] = {0, };
        int index = __get_my_slot_index(id);
+       int ret = DOWNLOAD_ADAPTOR_ERROR_NONE;
 
        if (index < 0 || !temp_path)
                return DOWNLOAD_ADAPTOR_ERROR_INVALID_PARAMETER;
 
        if (!g_interface_slots[index].saved_temp_path) {
-               *temp_path = NULL;
-               return DOWNLOAD_ADAPTOR_ERROR_NO_DATA;
+               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);
+               }
+       } else {
+               *temp_path = strdup(g_interface_slots[index].saved_temp_path);
        }
-
-       *temp_path = strdup(g_interface_slots[index].saved_temp_path);
-       return DOWNLOAD_ADAPTOR_ERROR_NONE;
+       return ret;
 }
 
 int dp_interface_get_content_name(const int id, char **content_name)