2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include "mf-ug-fs-util.h"
23 #include "mf-ug-util.h"
25 static int __mf_ug_fs_oper_sort_by_date_cb_O2R(const void *d1, const void *d2);
26 static int __mf_ug_fs_oper_sort_by_name_cb_A2Z(const void *d1, const void *d2);
27 static int __mf_ug_fs_oper_sort_by_type_cb_A2Z(const void *d1, const void *d2);
28 static int __mf_ug_fs_oper_sort_by_size_cb_S2L(const void *d1, const void *d2);
29 static int __mf_ug_fs_oper_sort_by_name_cb_Z2A(const void *d1, const void *d2);
30 static int __mf_ug_fs_oper_sort_by_date_cb_R2O(const void *d1, const void *d2);
31 static int __mf_ug_fs_oper_sort_by_type_cb_Z2A(const void *d1, const void *d2);
32 static int __mf_ug_fs_oper_sort_by_size_cb_L2S(const void *d1, const void *d2);
34 /*********************
35 **Function name: __mf_ug_fs_oper_file_system_error
37 ** const char* src: source path
38 ** const char* dst: destination path
39 ** int check_option: check option
45 ** input parameter checking
47 *********************/
48 static const char *__mf_ug_fs_oper_get_file(const char *path)
55 if ((result = strrchr(path, '/'))) {
58 result = (char *)path;
64 static int __mf_ug_fs_oper_file_system_error(const char *src, const char *dst, int check_option)
66 if ((check_option & MF_ERROR_CHECK_SRC_ARG_VALID) && (src == NULL)) {
67 return MYFILE_ERR_SRC_ARG_INVALID;
69 if ((check_option & MF_ERROR_CHECK_SRC_EXIST) && (!ecore_file_exists(src))) {
70 return MYFILE_ERR_SRC_NOT_EXIST;
73 if (check_option & MF_ERROR_CHECK_SRC_PATH_VALID) {
74 if (!ecore_file_is_dir(src)) {
75 if (mf_ug_file_attr_is_right_file_path(src)) {
76 return MYFILE_ERR_INVALID_FILE_PATH;
79 if (mf_ug_file_attr_is_right_dir_path(src)) {
80 return MYFILE_ERR_INVALID_DIR_PATH;
85 if (check_option & MF_ERROR_CHECK_DUPLICATED) {
86 char *parent_path = NULL;
88 if (!mf_ug_file_attr_get_parent_path(dst, &parent_path)) {
89 if (mf_ug_file_attr_is_duplicated_name(parent_path, __mf_ug_fs_oper_get_file(dst))) {
90 UG_SAFE_FREE_CHAR(parent_path);
91 return MYFILE_ERR_DUPLICATED_NAME;
93 UG_SAFE_FREE_CHAR(parent_path);
95 UG_SAFE_FREE_CHAR(parent_path);
96 return MYFILE_ERR_GET_PARENT_PATH_FAIL;
99 return MYFILE_ERR_NONE;
102 /*********************
103 **Function name: mf_ug_fs_oper_read_dir
105 ** char *path: path which we need to read
106 ** Eina_List** dir_list: output parameter of dir list under specified path
107 ** Eina_List** file_list: output parameter of file list under specified path
113 ** read element under the specified path
115 *********************/
116 int mf_ug_fs_oper_read_dir(const char *path, Eina_List **dir_list, Eina_List **file_list)
122 ug_mf_retvm_if(path == NULL, MYFILE_ERR_INVALID_ARG, "path is null");
123 ug_mf_retvm_if(dir_list == NULL, MYFILE_ERR_INVALID_ARG, "dir_list is null");
124 ug_mf_retvm_if(file_list == NULL, MYFILE_ERR_INVALID_ARG, "file_list is null");
126 int option = MF_ERROR_CHECK_SRC_ARG_VALID | MF_ERROR_CHECK_SRC_EXIST | MF_ERROR_CHECK_SRC_PATH_VALID;
127 int ret = __mf_ug_fs_oper_file_system_error(path, NULL, option);
129 if (ret != MYFILE_ERR_NONE) {
133 pDir = opendir(path);
136 return MYFILE_ERR_DIR_OPEN_FAIL;
139 while ((ent = readdir(pDir)) != NULL) {
140 GString *childpath = NULL;
141 ugFsNodeInfo *pNode = NULL;
143 if (strncmp(ent->d_name, ".", 1) == 0 || strcmp(ent->d_name, "..") == 0) {
147 if ((ent->d_type & DT_DIR) == 0 && (ent->d_type & DT_REG) == 0) {
150 #ifdef UG_DEBUG_FOLDER_OPTION
151 if ((ent->d_type & DT_DIR) != 0) {
152 if ((strlen(path) == strlen(PHONE_FOLDER)) && (strcmp(path, PHONE_FOLDER) == 0)
153 && (strlen(ent->d_name) == strlen(DEBUG_FOLDER)) && (strcmp(ent->d_name, DEBUG_FOLDER) == 0)) {
158 pNode = (ugFsNodeInfo *) malloc(sizeof(ugFsNodeInfo));
163 memset(pNode, 0, sizeof(ugFsNodeInfo));
164 snprintf(pNode->path, sizeof(pNode->path), "%s", path);
165 snprintf(pNode->name, sizeof(pNode->name), "%s", ent->d_name);
166 if (ent->d_type & DT_DIR) {
167 pNode->type = UG_FILE_TYPE_DIR;
168 } else if (ent->d_type & DT_REG) {
169 mf_ug_file_attr_get_file_category(ent->d_name, &(pNode->type));
171 childpath = g_string_new(path);
172 if (childpath == NULL) {
177 g_string_append_printf(childpath, "/%s", ent->d_name);
178 mf_ug_file_attr_get_file_stat(childpath->str, &pNode);
179 if (pNode->type == UG_FILE_TYPE_DIR) {
180 ug_mf_debug("dir append\n");
181 *dir_list = eina_list_append(*dir_list, pNode);
183 ug_mf_debug("file append\n");
184 ret = mf_ug_file_attr_get_file_ext(childpath->str, &pNode->ext);
185 if (ret != MYFILE_ERR_NONE) {
188 *file_list = eina_list_append(*file_list, pNode);
191 g_string_free(childpath, TRUE);
196 return MYFILE_ERR_NONE;
199 /*********************
200 **Function name: __mf_ug_fs_oper_exec_filter
202 ** ugFsNodeInfo* pnode_info: the node we need to check for filter
203 ** int option: filter
209 ** check if the node satisfied the filter option
210 *********************/
211 static mf_ug_drm_file_mime_type __mf_ug_fs_oper_get_drm_file_type_by_mime(char *mime_type)
213 gchar **result = NULL;
214 if (mime_type != NULL) {
215 result = g_strsplit(mime_type, "/", 0);
216 if (result && (*result)) {
217 ug_mf_debug("*result is [%s]", *result);
218 if (g_strcmp0(*result, "audio") == 0) {
220 return MF_UG_DRM_RINGTONE_FILE;
221 } else if (g_strcmp0(*result, "image") == 0) {
223 return MF_UG_DRM_IMAGE_FILE;
226 return MF_UG_DRM_UNKNOW_FILE;
230 return MF_UG_DRM_UNKNOW_FILE;
233 return MF_UG_DRM_UNKNOW_FILE;
237 mf_ug_drm_file_mime_type mf_ug_fs_oper_get_drm_type(char *path)
239 drm_result_e res = 0;
240 drm_content_info_s dcf_content_info;
242 res = drm_get_content_info(path, &dcf_content_info);
245 if (res == DRM_RETURN_SUCCESS) {
246 mf_ug_drm_file_mime_type drm_mime_type = __mf_ug_fs_oper_get_drm_file_type_by_mime(dcf_content_info.mime_type);
247 return drm_mime_type;
249 return MF_UG_DRM_UNKNOW_FILE;
253 static int __drm_is_action_allowed(const char *path, drm_action_type_e action)
255 drm_bool_type_e is_allowed = 0;
256 drm_action_allowed_data_s action_data;
259 memset(&action_data,0x0,sizeof(drm_action_allowed_data_s));
260 UG_SAFE_STRCPY(action_data.file_path, path);
262 ret = drm_is_action_allowed(action,&action_data,&is_allowed);
263 if(DRM_RETURN_SUCCESS == ret && DRM_TRUE == is_allowed){
270 static bool __mf_ug_fs_oper_exec_drm_filter(ugFsNodeInfo *pnode_info, int option)
272 if (pnode_info == NULL) {
277 char *fullpath = NULL;
278 drm_result_e res = DRM_RETURN_INTERNAL_ERROR;
279 if (option & MF_UG_FILTER_DRM_ALL) {
283 if (option & MF_UG_FILTER_DRM_WITHOUT_FL) {
284 fullpath = g_strconcat(pnode_info->path, "/", pnode_info->name, NULL);
285 res = __drm_is_action_allowed(fullpath, DRM_IS_FORWARDING_ALLOWED);
286 if (res == DRM_RETURN_SUCCESS) {
293 if (option & MF_UG_FILTER_DRM_IMAGE) {
294 fullpath = g_strconcat(pnode_info->path, "/", pnode_info->name, NULL);
296 result = __drm_is_action_allowed(fullpath, DRM_HAS_VALID_SETAS_STATUS);
298 mf_ug_drm_file_mime_type drm_mime_type = mf_ug_fs_oper_get_drm_type(fullpath);
299 if (drm_mime_type == MF_UG_DRM_IMAGE_FILE)
308 if (option & MF_UG_FILTER_DRM_RINGTONE) {
309 fullpath = g_strconcat(pnode_info->path, "/", pnode_info->name, NULL);
311 result = __drm_is_action_allowed(fullpath, DRM_HAS_VALID_SETAS_STATUS);
313 mf_ug_drm_file_mime_type drm_mime_type = mf_ug_fs_oper_get_drm_type(fullpath);
314 if (drm_mime_type == MF_UG_DRM_RINGTONE_FILE)
327 static bool __mf_ug_fs_oper_exec_filter(ugFsNodeInfo *pnode_info, int option)
329 if (pnode_info == NULL) {
332 if (option & UG_FILTER_CATEGORY_IMAGE) {
333 if (pnode_info->type == UG_FILE_TYPE_IMAGE) {
337 if (option & UG_FILTER_CATEGORY_VIDEO) {
338 if (pnode_info->type == UG_FILE_TYPE_VIDEO) {
342 if (option & UG_FILTER_CATEGORY_SOUND) {
343 if (pnode_info->type == UG_FILE_TYPE_SOUND) {
347 if (option & UG_FILTER_CATEGORY_VOICE) {
348 if (pnode_info->type == UG_FILE_TYPE_VOICE) {
352 if (option & UG_FILTER_CATEGORY_MUSIC) {
353 if (pnode_info->type == UG_FILE_TYPE_MUSIC) {
357 if (option & UG_FILTER_CATEGORY_HTML) {
358 if (pnode_info->type == UG_FILE_TYPE_HTML) {
362 if (option & UG_FILTER_CATEGORY_FLASH) {
363 if (pnode_info->type == UG_FILE_TYPE_FLASH) {
367 if (option & UG_FILTER_CATEGORY_GAME) {
368 if (pnode_info->type == UG_FILE_TYPE_GAME) {
372 if (option & UG_FILTER_CATEGORY_APP) {
373 if (pnode_info->type == UG_FILE_TYPE_APP) {
377 if (option & UG_FILTER_CATEGORY_THEME) {
378 if (pnode_info->type == UG_FILE_TYPE_THEME) {
382 if (option & UG_FILTER_CATEGORY_DOC) {
383 if (pnode_info->type == UG_FILE_TYPE_DOC) {
387 if (option & UG_FILTER_CATEGORY_EXCEL) {
388 if (pnode_info->type == UG_FILE_TYPE_EXCEL) {
392 if (option & UG_FILTER_CATEGORY_PPT) {
393 if (pnode_info->type == UG_FILE_TYPE_PPT) {
397 if (option & UG_FILTER_CATEGORY_PDF) {
398 if (pnode_info->type == UG_FILE_TYPE_PDF) {
402 if (option & UG_FILTER_CATEGORY_TXT) {
403 if (pnode_info->type == UG_FILE_TYPE_TXT) {
407 if (option & UG_FILTER_CATEGORY_VCONTACT) {
408 if (pnode_info->type == UG_FILE_TYPE_VCONTACT) {
412 if (option & UG_FILTER_CATEGORY_VCALENDAR) {
413 if (pnode_info->type == UG_FILE_TYPE_VCALENDAR) {
417 if (option & UG_FILTER_CATEGORY_VNOTE) {
418 if (pnode_info->type == UG_FILE_TYPE_VNOTE) {
422 if (option & UG_FILTER_CATEGORY_VBOOKMARK) {
423 if (pnode_info->type == UG_FILE_TYPE_VBOOKMARK) {
427 if (option & UG_FILTER_CATEGORY_VIDEO_PROJECT) {
428 if (pnode_info->type == UG_FILE_TYPE_VIDEO_PROJECT) {
432 if (option & UG_FILTER_CATEGORY_SVG) {
433 if (pnode_info->type == UG_FILE_TYPE_SVG) {
437 if (option & UG_FILTER_CATEGORY_RSS) {
438 if (pnode_info->type == UG_FILE_TYPE_RSS) {
442 if (option & UG_FILTER_CATEGORY_ETC) {
443 if (pnode_info->type == UG_FILE_TYPE_ETC) {
450 int mf_ug_fs_oper_list_filter(Eina_List *in_list, Eina_List **out_list, int option, int drm_opt)
453 if (in_list == NULL) {
454 return MYFILE_ERR_SRC_ARG_INVALID;
457 if (out_list == NULL) {
458 return MYFILE_ERR_DST_ARG_INVALID;
463 return MYFILE_ERR_NONE;
467 ugFsNodeInfo *data = NULL;
468 EINA_LIST_FOREACH(in_list, l, data) {
469 if (data->type == UG_FILE_TYPE_DRM && __mf_ug_fs_oper_exec_drm_filter(data, drm_opt)) {
470 ug_debug("file [%s] is drm file", data->name);
471 *out_list = eina_list_append(*out_list, data);
472 } else if (__mf_ug_fs_oper_exec_filter(data, option)) {
473 *out_list = eina_list_append(*out_list, data);
476 return MYFILE_ERR_NONE;
479 /******************************
480 ** Prototype : ug_mf_list_filter_by_extention
481 ** Description : filter from list by extension
482 ** Input : Eina_List *in_list
483 ** Eina_List **out_list
491 ** 1.Date : 2010/12/10
493 ** Modification : Created function
495 ******************************/
496 int mf_ug_fs_oper_list_filter_by_extension(Eina_List *in_list, Eina_List **out_list, char *ext)
498 if (in_list == NULL) {
499 return MYFILE_ERR_SRC_ARG_INVALID;
502 if (out_list == NULL) {
503 return MYFILE_ERR_DST_ARG_INVALID;
508 return MYFILE_ERR_NONE;
512 ugFsNodeInfo *data = NULL;
515 char *temp_ext = malloc(strlen(ext) + 1);
516 gchar **result = NULL;
517 gchar **params = NULL;
519 EINA_LIST_FOREACH(in_list, l, data) {
520 memset(temp_ext, 0, strlen(ext) + 1);
521 strncpy(temp_ext, ext, strlen(ext));
522 result = g_strsplit(temp_ext, seps, 0);
523 if (result == NULL) {
526 for (params = result; *params; params++) {
527 if (data->ext == NULL)
529 if (strcasecmp(data->ext, *params) == 0) {
530 *out_list = eina_list_append(*out_list, data);
539 return MYFILE_ERR_NONE;
542 static int __mf_ug_fs_oper_sort_by_priority(const void *d1, const void *d2, int sequence_type)
545 switch(sequence_type) {
546 case MF_UG_SORT_BY_PRIORITY_TYPE_A2Z:
547 ret = __mf_ug_fs_oper_sort_by_date_cb_O2R(d1, d2);
549 ret = __mf_ug_fs_oper_sort_by_size_cb_S2L(d1, d2);
551 ret = __mf_ug_fs_oper_sort_by_name_cb_A2Z(d1, d2);
555 case MF_UG_SORT_BY_PRIORITY_TYPE_Z2A:
556 ret = __mf_ug_fs_oper_sort_by_date_cb_R2O(d1, d2);
558 ret = __mf_ug_fs_oper_sort_by_size_cb_L2S(d1, d2);
560 ret = __mf_ug_fs_oper_sort_by_name_cb_Z2A(d1, d2);
564 case MF_UG_SORT_BY_PRIORITY_DATE_O2R:
565 ret = __mf_ug_fs_oper_sort_by_size_cb_S2L(d1, d2);
567 ret = __mf_ug_fs_oper_sort_by_name_cb_A2Z(d1, d2);
570 case MF_UG_SORT_BY_PRIORITY_DATE_R2O:
571 ret = __mf_ug_fs_oper_sort_by_size_cb_L2S(d1, d2);
573 ret = __mf_ug_fs_oper_sort_by_name_cb_Z2A(d1, d2);
576 case MF_UG_SORT_BY_PRIORITY_SIZE_S2L:
577 ret = __mf_ug_fs_oper_sort_by_name_cb_A2Z(d1, d2);
579 case MF_UG_SORT_BY_PRIORITY_SIZE_L2S:
580 ret = __mf_ug_fs_oper_sort_by_name_cb_Z2A(d1, d2);
587 /*********************
588 **Function name: __sort_by_name_cb
590 ** const void *d1: node1 to compare
591 ** const void *d2: node2 to compare
599 ** sort the list order by the Assic table
602 *********************/
603 static int __mf_ug_fs_oper_sort_by_name_cb_A2Z(const void *d1, const void *d2)
605 ugFsNodeInfo *txt1 = (ugFsNodeInfo *) d1;
606 ugFsNodeInfo *txt2 = (ugFsNodeInfo *) d2;
618 name1 = g_ascii_strdown(txt1->name, strlen(txt1->name));
622 name2 = g_ascii_strdown(txt2->name, strlen(txt2->name));
628 result = g_strcmp0(name1, name2);
638 /*********************
639 **Function name: __sort_by_date_cb
641 ** const void *d1: node1 to compare
642 ** const void *d2: node2 to compare
650 ** sort the list order by the later created the later shown
651 *********************/
652 static int __mf_ug_fs_oper_sort_by_date_cb_O2R(const void *d1, const void *d2)
655 ugFsNodeInfo *time1 = (ugFsNodeInfo *) d1;
656 ugFsNodeInfo *time2 = (ugFsNodeInfo *) d2;
665 if (time1->date > time2->date) {
667 } else if (time1->date < time2->date) {
674 ret = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_DATE_O2R);
679 /*********************
680 **Function name: __sort_by_type_cb
682 ** const void *d1: node1 to compare
683 ** const void *d2: node2 to compare
691 ** sort the list order by the category type value
692 *********************/
693 static int __mf_ug_fs_oper_sort_by_type_cb_A2Z(const void *d1, const void *d2)
695 ugFsNodeInfo *type1 = (ugFsNodeInfo *) d1;
696 ugFsNodeInfo *type2 = (ugFsNodeInfo *) d2;
701 if (type1 == NULL || type1->ext == NULL) {
705 if (type2 == NULL || type2->ext == NULL) {
708 ext1 = g_ascii_strdown(type1->ext, strlen(type1->ext));
712 ext2 = g_ascii_strdown(type2->ext, strlen(type2->ext));
718 result = g_strcmp0(ext1, ext2);
726 result = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_TYPE_A2Z);
732 /*order: the one with smaller size will be shown earlier*/
733 /*********************
734 **Function name: __sort_by_name_cb
736 ** const void *d1: node1 to compare
737 ** const void *d2: node2 to compare
745 ** sort the list order by size, rule is the smaller the later shown
746 *********************/
747 static int __mf_ug_fs_oper_sort_by_size_cb_S2L(const void *d1, const void *d2)
750 ugFsNodeInfo *size1 = (ugFsNodeInfo *) d1;
751 ugFsNodeInfo *size2 = (ugFsNodeInfo *) d2;
761 if (size1->size > size2->size) {
763 } else if (size1->size < size2->size) {
770 ret = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_SIZE_S2L);
775 /*********************
776 **Function name: __mf_fs_oper_sort_by_name_cb_Z2A
778 ** const void *d1: node1 to compare
779 ** const void *d2: node2 to compare
786 ** sort the list order by the Assic table
789 *********************/
790 static int __mf_ug_fs_oper_sort_by_name_cb_Z2A(const void *d1, const void *d2)
792 ugFsNodeInfo *txt1 = (ugFsNodeInfo *) d1;
793 ugFsNodeInfo *txt2 = (ugFsNodeInfo *) d2;
803 result = strcasecmp(txt1->name, txt2->name);
812 /*********************
813 **Function name: __sort_by_date_cb
815 ** const void *d1: node1 to compare
816 ** const void *d2: node2 to compare
824 ** sort the list order by the later created the later shown
825 *********************/
826 static int __mf_ug_fs_oper_sort_by_date_cb_R2O(const void *d1, const void *d2)
829 ugFsNodeInfo *time1 = (ugFsNodeInfo *) d1;
830 ugFsNodeInfo *time2 = (ugFsNodeInfo *) d2;
838 if (time1->date > time2->date) {
840 } else if (time1->date < time2->date) {
847 ret = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_DATE_R2O);
852 /*********************
853 **Function name: __sort_by_type_cb
855 ** const void *d1: node1 to compare
856 ** const void *d2: node2 to compare
864 ** sort the list order by the category type value
865 *********************/
866 static int __mf_ug_fs_oper_sort_by_type_cb_Z2A(const void *d1, const void *d2)
868 ugFsNodeInfo *type1 = (ugFsNodeInfo *) d1;
869 ugFsNodeInfo *type2 = (ugFsNodeInfo *) d2;
874 if (type1 == NULL || type1->ext == NULL) {
878 if (type2 == NULL || type2->ext == NULL) {
882 ext1 = g_ascii_strdown(type1->ext, strlen(type1->ext));
886 ext2 = g_ascii_strdown(type2->ext, strlen(type2->ext));
892 result = g_strcmp0(ext1, ext2);
898 result = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_TYPE_Z2A);
904 /*order: the one with smaller size will be shown earlier*/
905 /*********************
906 **Function name: __sort_by_name_cb
908 ** const void *d1: node1 to compare
909 ** const void *d2: node2 to compare
917 ** sort the list order by size, rule is the smaller the later shown
918 *********************/
919 static int __mf_ug_fs_oper_sort_by_size_cb_L2S(const void *d1, const void *d2)
922 ugFsNodeInfo *size1 = (ugFsNodeInfo *) d1;
923 ugFsNodeInfo *size2 = (ugFsNodeInfo *) d2;
933 if (size1->size > size2->size) {
935 } else if (size1->size < size2->size) {
942 ret = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_SIZE_L2S);
947 /*********************
948 **Function name: mf_fs_oper_sort_list
950 ** Eina_List **list: the list we need to sort
951 ** int sort_opt: sort option
957 ** sort the list order by sort option with the call back
958 *********************/
959 void mf_ug_fs_oper_sort_list(Eina_List **list, int sort_opt)
961 Eina_Compare_Cb sort_func = NULL;
966 case MF_UG_SORT_BY_NAME_A2Z:
967 sort_func = __mf_ug_fs_oper_sort_by_name_cb_A2Z;
969 case MF_UG_SORT_BY_TYPE_A2Z:
970 sort_func = __mf_ug_fs_oper_sort_by_type_cb_A2Z;
972 case MF_UG_SORT_BY_SIZE_S2L:
973 sort_func = __mf_ug_fs_oper_sort_by_size_cb_S2L;
975 case MF_UG_SORT_BY_DATE_O2R:
976 sort_func = __mf_ug_fs_oper_sort_by_date_cb_O2R;
978 case MF_UG_SORT_BY_NAME_Z2A:
979 sort_func = __mf_ug_fs_oper_sort_by_name_cb_Z2A;
981 case MF_UG_SORT_BY_TYPE_Z2A:
982 sort_func = __mf_ug_fs_oper_sort_by_type_cb_Z2A;
984 case MF_UG_SORT_BY_SIZE_L2S:
985 sort_func = __mf_ug_fs_oper_sort_by_size_cb_L2S;
987 case MF_UG_SORT_BY_DATE_R2O:
988 sort_func = __mf_ug_fs_oper_sort_by_date_cb_R2O;
991 sort_func = __mf_ug_fs_oper_sort_by_type_cb_A2Z;
994 *list = eina_list_sort(*list, eina_list_count(*list), sort_func);
997 int mf_ug_fs_oper_create_dir(const char *dir)
999 int option = MF_ERROR_CHECK_SRC_ARG_VALID | MF_ERROR_CHECK_DUPLICATED;
1000 int ret = __mf_ug_fs_oper_file_system_error(dir, dir, option);
1006 ret = mf_ug_file_attr_is_right_dir_path(dir);
1012 mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
1014 if (mkdir(dir, default_mode) < 0) {
1015 return MYFILE_ERR_DIR_CREATE_FAIL;
1017 return MYFILE_ERR_NONE;