From 9c806c722e871290a84ca51a41300152298ca5af Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Thu, 9 May 2019 16:50:32 +0900 Subject: [PATCH] Fix bug when destination path is directory Change-Id: I5c4858258abc7692767d6ca8ce6f4697c2736eea Signed-off-by: Minje Ahn --- src/media_info.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/media_info.c b/src/media_info.c index 8a524b4..0311f61 100755 --- a/src/media_info.c +++ b/src/media_info.c @@ -1932,6 +1932,14 @@ int media_info_move_to_db(media_info_h media, const char* dst_path) ret = _media_content_replace_path(_media->file_path, org_repl_path); media_content_retvm_if(!STRING_VALID(org_repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed"); + /* If dst_path is folder, append file_name */ + if (g_file_test(repl_path, G_FILE_TEST_IS_DIR)) { + if (repl_path[strlen(repl_path) - 1] != '/') + SAFE_STRLCAT(repl_path, "/", sizeof(repl_path)); + + SAFE_STRLCAT(repl_path, _media->display_name, sizeof(repl_path)); + } + /* If the two paths are the same, do nothing */ media_content_retvm_if(g_strcmp0(repl_path, org_repl_path) == 0, MEDIA_CONTENT_ERROR_NONE, "Same path"); -- 2.7.4