From 7b9a13093ad4a6357c79fbd2365ffc6c8fcafeb5 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 29 May 2020 17:48:09 +0900 Subject: [PATCH] Fix the issue AR sticker was not deleted Change-Id: I4d9d03b42cc1efcec64fca87af3c0419b30c11a7 --- receiver/inc/config.h | 2 ++ receiver/src/ft.cpp | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/receiver/inc/config.h b/receiver/inc/config.h index ecc3c10..bafee30 100644 --- a/receiver/inc/config.h +++ b/receiver/inc/config.h @@ -31,4 +31,6 @@ #define THUMBNAIL_WIDTH 96 #define THUMBNAIL_HEIGHT 96 +#define STICKER_DIRECTORY "/opt/usr/share/sticker-data" + #endif /* __CONFIG_H__ */ diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index f243539..b90dad1 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -833,11 +833,24 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in LOGD("Add file : %s, len : %d", file_name.c_str(), file_len); total_file_count_in_group++; } else { - LOGD("Delete file : %s, len : %d", file_name.c_str(), file_len); + char *app_id = NULL; + char file_path[PATH_MAX]; + char del_path[PATH_MAX]; + std::size_t found = file_name.find_last_of("/"); + string del_file_name = file_name.substr(found+1); + char *data_path = app_get_shared_data_path(); + app_get_id(&app_id); + snprintf(file_path, sizeof(file_path), "%s/%s", data_path, del_file_name.c_str()); + snprintf(del_path, sizeof(del_path), "%s/%s%s",STICKER_DIRECTORY, app_id, file_path); + + LOGD("Delete file : %s, len : %d", del_path, file_len); if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { - delete_sticker_data(file_name.c_str()); + delete_sticker_data(del_path); destroy_sticker_provider_handle(); } + + if (app_id) + free(app_id); } } } -- 2.7.4