forked from enlightenment/efl
efreet: optimize stat
use eina_file_stat_ls instead of eina_file.*_ls + ecore_file_is_dir SVN revision: 78173
This commit is contained in:
parent
b6add7a518
commit
4eb8b955a9
|
@ -140,7 +140,7 @@ cache_scan(const char *path, const char *base_id, int priority, int recurse, int
|
|||
|
||||
if (!ecore_file_is_dir(path)) return 1;
|
||||
|
||||
it = eina_file_direct_ls(path);
|
||||
it = eina_file_stat_ls(path);
|
||||
if (!it) return 1;
|
||||
|
||||
id[0] = '\0';
|
||||
|
@ -159,7 +159,7 @@ cache_scan(const char *path, const char *base_id, int priority, int recurse, int
|
|||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s", path, fname);
|
||||
if (ecore_file_is_dir(buf))
|
||||
if (info->type == EINA_FILE_DIR)
|
||||
{
|
||||
if (recurse)
|
||||
cache_scan(buf, file_id, priority, recurse, changed);
|
||||
|
|
|
@ -1033,11 +1033,12 @@ efreet_desktop_changes_listen_recursive(const char *path)
|
|||
|
||||
efreet_desktop_changes_monitor_add(path);
|
||||
|
||||
it = eina_file_direct_ls(path);
|
||||
it = eina_file_stat_ls(path);
|
||||
if (!it) return;
|
||||
EINA_ITERATOR_FOREACH(it, info)
|
||||
{
|
||||
if (ecore_file_is_dir(info->path)) efreet_desktop_changes_listen_recursive(info->path);
|
||||
if (info->type != EINA_FILE_DIR) continue;
|
||||
efreet_desktop_changes_listen_recursive(info->path);
|
||||
}
|
||||
eina_iterator_free(it);
|
||||
}
|
||||
|
|
|
@ -852,7 +852,7 @@ static void
|
|||
efreet_icon_changes_monitor_add(const char *path)
|
||||
{
|
||||
Eina_Iterator *it;
|
||||
const char *ent;
|
||||
Eina_File_Direct_Info *info;
|
||||
|
||||
if (!ecore_file_is_dir(path)) return;
|
||||
if (eina_hash_find(change_monitors, path)) return;
|
||||
|
@ -861,13 +861,13 @@ efreet_icon_changes_monitor_add(const char *path)
|
|||
efreet_icon_changes_cb,
|
||||
NULL));
|
||||
|
||||
it = eina_file_ls(path);
|
||||
it = eina_file_stat_ls(path);
|
||||
if (!it) return;
|
||||
EINA_ITERATOR_FOREACH(it, ent)
|
||||
EINA_ITERATOR_FOREACH(it, info)
|
||||
{
|
||||
if (!ecore_file_is_dir(ent)) continue;
|
||||
eina_hash_add(change_monitors, ent,
|
||||
ecore_file_monitor_add(ent,
|
||||
if (info->type != EINA_FILE_DIR) continue;
|
||||
eina_hash_add(change_monitors, info->path,
|
||||
ecore_file_monitor_add(info->path,
|
||||
efreet_icon_changes_cb,
|
||||
NULL));
|
||||
}
|
||||
|
|
|
@ -1808,7 +1808,7 @@ efreet_menu_handle_legacy_dir_helper(Efreet_Menu_Internal *root,
|
|||
efreet_menu_create_filter_list(legacy_internal);
|
||||
legacy_internal->filters = eina_list_append(legacy_internal->filters, filter);
|
||||
|
||||
it = eina_file_direct_ls(path);
|
||||
it = eina_file_stat_ls(path);
|
||||
if (it)
|
||||
{
|
||||
Eina_File_Direct_Info *info;
|
||||
|
@ -1822,7 +1822,7 @@ efreet_menu_handle_legacy_dir_helper(Efreet_Menu_Internal *root,
|
|||
|
||||
fname = info->path + info->name_start;
|
||||
/* recurse into sub directories */
|
||||
if (ecore_file_is_dir(info->path))
|
||||
if (info->type == EINA_FILE_DIR)
|
||||
{
|
||||
Efreet_Menu_Internal *ret;
|
||||
|
||||
|
@ -3295,7 +3295,7 @@ efreet_menu_app_dir_scan(Efreet_Menu_Internal *internal, const char *path, const
|
|||
Eina_Iterator *it;
|
||||
Eina_File_Direct_Info *info;
|
||||
|
||||
it = eina_file_direct_ls(path);
|
||||
it = eina_file_stat_ls(path);
|
||||
if (!it) return 1;
|
||||
|
||||
EINA_ITERATOR_FOREACH(it, info)
|
||||
|
@ -3308,7 +3308,7 @@ efreet_menu_app_dir_scan(Efreet_Menu_Internal *internal, const char *path, const
|
|||
else
|
||||
strcpy(buf2, fname);
|
||||
|
||||
if (ecore_file_is_dir(info->path))
|
||||
if (info->type == EINA_FILE_DIR)
|
||||
{
|
||||
if (!legacy)
|
||||
efreet_menu_app_dir_scan(internal, info->path, buf2, legacy);
|
||||
|
@ -3403,7 +3403,7 @@ efreet_menu_directory_dir_scan(const char *path, const char *relative_path,
|
|||
Eina_File_Direct_Info *info;
|
||||
char *ext;
|
||||
|
||||
it = eina_file_direct_ls(path);
|
||||
it = eina_file_stat_ls(path);
|
||||
if (!it) return 1;
|
||||
|
||||
EINA_ITERATOR_FOREACH(it, info)
|
||||
|
@ -3416,7 +3416,7 @@ efreet_menu_directory_dir_scan(const char *path, const char *relative_path,
|
|||
else
|
||||
strcpy(buf2, fname);
|
||||
|
||||
if (ecore_file_is_dir(info->path))
|
||||
if (info->type == EINA_FILE_DIR)
|
||||
efreet_menu_directory_dir_scan(info->path, buf2, cache);
|
||||
|
||||
else
|
||||
|
|
|
@ -358,16 +358,18 @@ efreet_util_menus_find_helper(Eina_List *menus, const char *config_dir)
|
|||
char dbuf[PATH_MAX];
|
||||
|
||||
snprintf(dbuf, sizeof(dbuf), "%s/menus", config_dir);
|
||||
it = eina_file_direct_ls(dbuf);
|
||||
it = eina_file_stat_ls(dbuf);
|
||||
if (!it) return menus;
|
||||
EINA_ITERATOR_FOREACH(it, info)
|
||||
{
|
||||
const char *exten;
|
||||
|
||||
if (info->type == EINA_FILE_DIR) continue;
|
||||
|
||||
exten = strrchr(info->path + info->name_start, '.');
|
||||
if (!exten) continue;
|
||||
if (strcmp(".menu", exten)) continue;
|
||||
|
||||
if (ecore_file_is_dir(info->path)) continue;
|
||||
if (strcmp(".menu", exten)) continue;
|
||||
|
||||
menus = eina_list_append(menus, strdup(info->path));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue