int ret = MS_MEDIA_ERR_NONE;
char savename[MEDIA_SVC_PATHNAME_SIZE] = {0, };
char file_ext[MEDIA_SVC_FILE_EXT_LEN_MAX + 1] = {0, };
- char *thumb_dir = NULL;
char hash[255 + 1] = {0, };
char *thumbfile_ext = NULL;
- char *internal_thumb_path = NULL;
- char *external_thumb_path = NULL;
-
- ret = ms_user_get_default_thumb_store_path(uid, &internal_thumb_path);
- ret = ms_user_get_mmc_thumb_store_path(uid, &external_thumb_path);
+ char *thumb_dir = NULL;
- if (!STRING_VALID(internal_thumb_path) || !STRING_VALID(external_thumb_path)) {
- media_svc_error("fail to get thumbnail path");
- SAFE_FREE(internal_thumb_path);
- SAFE_FREE(external_thumb_path);
+ ret = ms_user_get_thumb_store_path(uid, storage_type, &thumb_dir);
+ if (!STRING_VALID(thumb_dir)) {
+ media_svc_error("ms_user_get_thumb_store_path failed");
return MS_MEDIA_ERR_INTERNAL;
}
- thumb_dir = (storage_type == MEDIA_SVC_STORAGE_INTERNAL) ? internal_thumb_path : external_thumb_path;
-
ret = __media_svc_check_thumb_dir(thumb_dir);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("__media_svc_check_thumb_dir");
- SAFE_FREE(internal_thumb_path);
- SAFE_FREE(external_thumb_path);
+ SAFE_FREE(thumb_dir);
return MS_MEDIA_ERR_INTERNAL;
}
ret = mb_svc_generate_hash_code(pathname, hash, sizeof(hash));
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("mb_svc_generate_hash_code failed : %d", ret);
- SAFE_FREE(internal_thumb_path);
- SAFE_FREE(external_thumb_path);
+ SAFE_FREE(thumb_dir);
return MS_MEDIA_ERR_INTERNAL;
}
thumbfile_ext = (char *)"bmp";
} else {
media_svc_error("Not proper img format");
- SAFE_FREE(internal_thumb_path);
- SAFE_FREE(external_thumb_path);
+ SAFE_FREE(thumb_dir);
return MS_MEDIA_ERR_INTERNAL;
}
SAFE_STRLCPY(thumb_path, savename, MEDIA_SVC_PATHNAME_SIZE);
/*media_svc_debug("thumb_path is [%s]", thumb_path); */
- SAFE_FREE(internal_thumb_path);
- SAFE_FREE(external_thumb_path);
+ SAFE_FREE(thumb_dir);
return MS_MEDIA_ERR_NONE;
}
int media_svc_delete_all_items_in_storage(const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
+ char *thumb_path = NULL;
media_svc_debug("media_svc_delete_all_items_in_storage [%d]", storage_type);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
if (storage_type != MEDIA_SVC_STORAGE_EXTERNAL_USB) {
- char *internal_thumb_path = NULL;
- char *external_thumb_path = NULL;
-
- ret = ms_user_get_default_thumb_store_path(uid, &internal_thumb_path);
- ret = ms_user_get_mmc_thumb_store_path(uid, &external_thumb_path);
-
- if (!STRING_VALID(internal_thumb_path) || !STRING_VALID(external_thumb_path)) {
+ ret = ms_user_get_thumb_store_path(uid, (ms_user_storage_type_e)storage_type, &thumb_path);
+ if (!STRING_VALID(thumb_path)) {
media_svc_error("fail to get thumbnail path");
- SAFE_FREE(internal_thumb_path);
- SAFE_FREE(external_thumb_path);
return MS_MEDIA_ERR_INTERNAL;
}
- const char *dirpath = (storage_type == MEDIA_SVC_STORAGE_INTERNAL) ? internal_thumb_path : external_thumb_path;
- /* remove thumbnails */
- if (STRING_VALID(dirpath))
- ret = _media_svc_remove_all_files_in_dir(dirpath);
- SAFE_FREE(internal_thumb_path);
- SAFE_FREE(external_thumb_path);
+ ret = _media_svc_remove_all_files_in_dir(thumb_path);
+ SAFE_FREE(thumb_path);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
}