SQLITE3_SAFE_FREE(sql);
if (STRING_VALID(_folder->folder_id) && g_src_path) {
- char *name_pinyin = NULL;
- bool pinyin_support = FALSE;
-
ret = _media_content_replace_path(_folder->path, repl_path);
-
- /* Set modified time */
- time_t date;
- time(&date);
- _folder->modified_time = date;
-
- /*Update Pinyin If Support Pinyin*/
- media_svc_check_pinyin_support(&pinyin_support);
- if (pinyin_support)
- media_svc_get_pinyin(_folder->name, &name_pinyin);
-
- sql = sqlite3_mprintf("UPDATE %Q SET path='%q', name='%q', modified_time=%d, name_pinyin='%q' WHERE folder_uuid=%Q",
- DB_TABLE_FOLDER, repl_path, _folder->name, _folder->modified_time, name_pinyin, _folder->folder_id);
-
- ret = _content_query_sql(sql);
- SQLITE3_SAFE_FREE(sql);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- SAFE_FREE(g_src_path);
- return ret;
- }
-
- /* Update all folder record's path, which are matched by old parent path */
- char *update_folder_path_sql = NULL;
- char src_path_slash[MAX_PATH_LEN + 1] = {0, };
- char dst_path_slash[MAX_PATH_LEN + 1] = {0, };
-
- snprintf(src_path_slash, sizeof(src_path_slash), "%s/", g_src_path);
- snprintf(dst_path_slash, sizeof(dst_path_slash), "%s/", repl_path);
-
- update_folder_path_sql = sqlite3_mprintf("UPDATE folder SET path = REPLACE( path, '%q', '%q');", src_path_slash, dst_path_slash);
-
- ret = _content_query_sql(update_folder_path_sql);
- SQLITE3_SAFE_FREE(update_folder_path_sql);
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());
SAFE_FREE(g_src_path);
media_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;
- if (_folder != NULL && STRING_VALID(name)) {
+ if (_folder != NULL && STRING_VALID(name) && name[0] != '.') {
if (STRING_VALID(_folder->path) && STRING_VALID(_folder->name)) {
char *folder_path = NULL;
char new_folder_path[MAX_PATH_LEN] = {0,};
- bool ignore_dir = FALSE;
char repl_path[MAX_PATH_LEN] = {0, };
memset(repl_path, 0, sizeof(repl_path));
snprintf(new_folder_path, sizeof(new_folder_path), "%s/%s", folder_path, name);
media_content_sec_debug("New Path : %s", new_folder_path);
- ret = _media_util_check_ignore_dir(new_folder_path, &ignore_dir);
- if (ignore_dir == TRUE) {
- media_content_error("Invalid folder path");
- SAFE_FREE(folder_path);
- return ret;
- }
-
SAFE_FREE(g_src_path);
g_src_path = strdup(repl_path);
_folder->path = strdup(repl_path);
media_content_retvm_if(_folder->path == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ _folder->name = strdup(name);
+ media_content_retvm_if(_folder->name == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
-
- _folder->name = strdup(name);
- media_content_retvm_if(_folder->name == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
} else {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;