From c7f817afabf03b9924e1da296d7a6e97c991fcc7 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 1 Apr 2020 19:44:25 +0900 Subject: [PATCH] Fix issue that does not create thumbnail before OOBE Change-Id: Icd2d94dbf8ad1cb2db5511668df2020c57dca048 --- receiver/src/ft.cpp | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 2107d32..bd8ae56 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -310,6 +310,27 @@ void accept_file() file_on_progress = TRUE; } +static int _create_thumbnail_directory() +{ + char thumb_path[PATH_MAX]; + char *data_path = NULL; + data_path = app_get_shared_data_path(); + sprintf(thumb_path, "%s/thumbnail", data_path); + + if (data_path) + free(data_path); + + if (access(thumb_path, F_OK) == 0) + return 0; + + if (mkdir(thumb_path, 0755) == -1) { + LOGE("directory create error"); + return -1; + } + + return 0; +} + bool request_sticker_data(const char *mode, const char *category, const char *type) { bool result = false; @@ -334,6 +355,9 @@ bool request_sticker_data(const char *mode, const char *category, const char *ty return false; } + if (_create_thumbnail_directory() != 0) + LOGE("Failed to create thumbnail directory"); + json_object_set_string_member(j_object, "msgId", STICKER_SYNC_START_REQ); json_object_set_int_member(j_object, "tID", ++t_id); json_object_set_string_member(j_object, "mode", mode); @@ -358,19 +382,6 @@ bool request_sticker_data(const char *mode, const char *category, const char *ty return result; } -static int _create_directory(const char *path) -{ - if (access(path, F_OK) == 0) - return 0; - - if (mkdir(path, 0755) == -1) { - LOGE("directory create error"); - return -1; - } - - return 0; -} - void request_sticker_feature() { JsonObject *j_object = NULL; @@ -398,12 +409,7 @@ void request_sticker_feature() json_object_unref(j_object); - char thumb_path[PATH_MAX]; - char *data_path = NULL; - data_path = app_get_shared_data_path(); - sprintf(thumb_path, "%s/thumbnail", data_path); - - if (_create_directory(thumb_path) != 0) + if (_create_thumbnail_directory() != 0) LOGE("Failed to create thumbnail directory"); } -- 2.7.4