Fix the file size display issue (TSAM-8415) 07/90907/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 5 Oct 2016 02:18:12 +0000 (11:18 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 5 Oct 2016 02:18:12 +0000 (11:18 +0900)
Modify the transfering file path as tizen 3.0 media folder

Change-Id: Icccfb40912b4b78a6681d6884f39a46e5dbf0390
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-share/include/bt-share-common.h
bt-share/src/bt-share-ipc.c

index 61b50ef1a7fcc764c6de1b3d8a7d27e53e82e7ec..694e0ad2950fe21cb3445c2985aea5375b8ed8f3 100644 (file)
@@ -35,6 +35,9 @@ extern "C" {
 
 #define STORAGE_PATH_LEN_MAX 255
 
+#define BT_OBEX_PATH_PREFIX "/opt/usr/media"
+#define BT_OBEX_DEFAULT_PATH "/opt/usr/home/owner/media"
+
 #define BT_DOWNLOAD_DEFAULT_PHONE_FOLDER "/opt/usr/home/owner/media/Downloads"
 #define BT_DOWNLOAD_DEFAULT_MMC_FOLDER "/opt/media/SDCardA1"
 #define BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER "/opt/usr/home/owner/media/Downloads"
index 3176035ba05495076555b8f08f3d60a7151ca6ed..d01490a1bb7897c199b950680c7202a0cb60120d 100644 (file)
@@ -99,6 +99,23 @@ static void __popup_res_cb(int res)
        DBG("-");
 }
 
+static char *__bt_transfer_folder_path(char *dest_path)
+{
+       char *dst_path = (char *)g_malloc0(STORAGE_PATH_LEN_MAX);
+       if (dst_path == NULL) {
+               ERR("Not enough memory!");
+               return NULL;
+       }
+
+       if (g_str_has_prefix(dest_path, BT_OBEX_PATH_PREFIX))
+               snprintf(dst_path, STORAGE_PATH_LEN_MAX, BT_OBEX_DEFAULT_PATH"%s", dest_path + strlen(BT_OBEX_PATH_PREFIX));
+       else
+               snprintf(dst_path, STORAGE_PATH_LEN_MAX, "%s", dest_path);
+
+       DBG("obex transfed path : %s", dst_path);
+       return dst_path;
+}
+
 static opc_transfer_info_t *__add_transfer_info(DBusMessage *msg)
 {
        DBG("+");
@@ -144,6 +161,7 @@ static opc_transfer_info_t *__add_transfer_info(DBusMessage *msg)
        memset(&file_attr, 0, sizeof(struct stat));
 
        while (dbus_message_iter_get_arg_type(&iter_file) == DBUS_TYPE_ARRAY) {
+               char *dst_path = NULL;
                i = 0;
                dbus_message_iter_recurse(&iter_file, &iter_filepath);
                len = dbus_message_iter_get_array_len(&iter_filepath);
@@ -163,6 +181,13 @@ static opc_transfer_info_t *__add_transfer_info(DBusMessage *msg)
                        i++;
                        dbus_message_iter_next(&iter_filepath);
                }
+
+               dst_path = __bt_transfer_folder_path(file_path);
+               if (dst_path != NULL) {
+                       g_free(file_path);
+                       file_path = dst_path;
+               }
+
                if (aul_get_mime_from_file(file_path, mime_type,
                                BT_MIME_TYPE_MAX_LEN) == AUL_R_OK)
                        INFO("mime type = %s", mime_type);