_dst->name = g_strdup(_src->name);
_dst->path = g_strdup(_src->path);
_dst->storage_uuid = g_strdup(_src->storage_uuid);
- _dst->storage_type = _src->storage_type;
*dst = (media_folder_h)_dst;
return MEDIA_CONTENT_ERROR_NONE;
}
-int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e* storage_type)
-{
- content_warn("DEPRECATION WARNING: media_folder_get_storage_type() is deprecated and will be removed from next release. Use storage_get_type_dev() instead.");
- media_folder_s *_folder = (media_folder_s*)folder;
-
- content_retip_if_fail(folder);
- content_retip_if_fail(storage_type);
-
- *storage_type = _folder->storage_type;
-
- return MEDIA_CONTENT_ERROR_NONE;
-}
-
-int media_folder_get_storage_id(media_folder_h folder, char **storage_id)
-{
- content_warn("DEPRECATION WARNING: media_folder_get_storage_id() is deprecated and will be removed from next release.");
- media_folder_s *_folder = (media_folder_s*)folder;
-
- content_retip_if_fail(folder);
- content_retip_if_fail(storage_id);
-
- *storage_id = g_strdup(_folder->storage_uuid);
-
- return MEDIA_CONTENT_ERROR_NONE;
-}
-
int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folder)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
_folder->folder_id = g_strdup(folder_id);
_folder->path = g_strdup((const char *)sqlite3_column_text(stmt, 0));
_folder->name = g_strdup((const char *)sqlite3_column_text(stmt, 1));
- _folder->storage_type = (int)sqlite3_column_int(stmt, 2);
_folder->storage_uuid = g_strdup((const char *)sqlite3_column_text(stmt, 3));
*folder = (media_folder_h)_folder;
int ret = MEDIA_CONTENT_ERROR_NONE;
content_warn("DEPRECATION WARNING: media_folder_update_to_db() is deprecated and will be removed from next release.");
media_folder_s *_folder = (media_folder_s*)folder;
- char repl_path[MAX_PATH_LEN] = {0, };
content_retip_if_fail(folder);
content_retip_if_fail(STRING_VALID(_folder->folder_id));
if (!g_src_path)
return ret;
-
- ret = _media_content_replace_path(_folder->path, repl_path);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- SAFE_FREE(g_src_path);
- return ret;
- }
- ret = media_svc_rename_folder(_content_get_db_handle(), _folder->storage_uuid, g_src_path, repl_path, _content_get_uid());
+ ret = media_svc_rename_folder(_content_get_db_handle(), _folder->storage_uuid, g_src_path, _folder->path, _content_get_uid());
SAFE_FREE(g_src_path);
return _content_error_capi(ret);
int ret = MEDIA_CONTENT_ERROR_NONE;
content_warn("DEPRECATION WARNING: media_folder_set_name() is deprecated and will be removed from next release.");
media_folder_s *_folder = (media_folder_s*)folder;
-
- char *folder_path = NULL;
- char new_folder_path[MAX_PATH_LEN] = {0,};
- char repl_path[MAX_PATH_LEN] = {0, };
+ char *parent_folder_path = NULL;
content_retip_if_fail(folder);
content_retip_if_fail(STRING_VALID(name));
content_retip_if_fail(STRING_VALID(_folder->path));
content_retip_if_fail(STRING_VALID(_folder->name));
- ret = _media_content_replace_path(_folder->path, repl_path);
- content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
-
- folder_path = g_path_get_dirname(repl_path);
- content_sec_debug("Existed Folder Path : %s", repl_path);
- snprintf(new_folder_path, sizeof(new_folder_path), "%s/%s", folder_path, name);
- content_sec_debug("New Path : %s", new_folder_path);
-
- g_free(g_src_path);
- g_src_path = g_strdup(repl_path);
-
- g_free(_folder->path);
+ // Change name..
g_free(_folder->name);
- g_free(folder_path);
-
- _folder->path = g_strdup(new_folder_path);
_folder->name = g_strdup(name);
- return ret;
-}
-
-int media_folder_insert_to_db(const char *path)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- char repl_path[MAX_PATH_LEN] = {0, };
- char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
-
- content_retip_if_fail(STRING_VALID(path));
-
- ret = _media_content_replace_path(path, repl_path);
- content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
-
- content_retvm_if(_media_util_is_ignorable_dir(repl_path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
+ // Change path..
+ g_free(g_src_path);
+ g_src_path = g_strdup(_folder->path);
+ g_free(_folder->path);
- ret = _media_content_check_dir(repl_path);
- content_retvm_if(ret == MEDIA_CONTENT_ERROR_PERMISSION_DENIED, ret, "Permission Denied");
- content_retvm_if(ret == MEDIA_CONTENT_ERROR_INVALID_PARAMETER, ret, "invalid path[%s]", path);
+ parent_folder_path = g_path_get_dirname(g_src_path);
+ _folder->path = g_strdup_printf("%s/%s", parent_folder_path, name);
+ g_free(parent_folder_path);
- ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid());
- if (ret != MS_MEDIA_ERR_NONE) {
- content_error("media_svc_get_storage_id failed : %d", ret);
- return _content_error_capi(ret);
- }
-
- ret = media_svc_check_folder_exist_by_path(_content_get_db_handle(), storage_id, repl_path);
- if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
- content_sec_debug("media_svc_check_folder_exist_by_path : no record : %s", repl_path);
- ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
-
- ret = ms_user_get_storage_type(_content_get_uid(), repl_path, &storage_type);
- if (ret != MS_MEDIA_ERR_NONE) {
- content_sec_error("ms_user_get_storage_type failed : %d", ret);
- return _content_error_capi(ret);
- }
-
- ret = media_svc_insert_folder(_content_get_db_handle(), storage_id, storage_type, repl_path, false, _content_get_uid());
- if (ret != MS_MEDIA_ERR_NONE) {
- if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL) {
- content_sec_error("This item is already inserted. This may be normal operation because other process already did this (%s)", repl_path);
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_sec_error("media_svc_insert_folder failed : %d (%s)", ret, repl_path);
- }
-
- return _content_error_capi(ret);
- }
-
- ret = media_svc_set_folder_scan_status(storage_id, repl_path, MEDIA_DIR_SCAN_DONE, false, _content_get_uid());
- if (ret != MS_MEDIA_ERR_NONE) {
- content_sec_error("ms_set_folder_scan_status failed : %d", ret);
- return _content_error_capi(ret);
- }
- } else if (ret != MS_MEDIA_ERR_NONE) {
- content_sec_error("media_svc_check_folder_exist_by_path failed : %d (%s)", ret, repl_path);
- return _content_error_capi(ret);
- }
+ content_sec_debug("Old[%s] New[%s]", g_src_path, _folder->path);
return ret;
}