forked from enlightenment/enlightenment
e: move everyone to use eina_file_direct_ls and friend.
NOTE: I think, but I am not sure yet, that only EFM should do this kind of operation or it could hard lock E17. SVN revision: 70546
This commit is contained in:
parent
c90e3c1517
commit
70d21a1f44
|
@ -158,7 +158,7 @@ static void _e_fm_ipc_file_mon_list_sync(E_Dir *ed);
|
|||
|
||||
static Eina_Bool _e_fm_ipc_cb_file_mon_list_idler(void *data);
|
||||
static Eina_Bool _e_fm_ipc_cb_fop_trash_idler(void *data);
|
||||
static char *_e_str_list_remove(Eina_List **list, char *str);
|
||||
static char *_e_str_list_remove(Eina_List **list, const char *str, int len);
|
||||
static void _e_fm_ipc_reorder(const char *file, const char *dst, const char *relative, int after);
|
||||
static void _e_fm_ipc_dir_del(E_Dir *ed);
|
||||
|
||||
|
@ -241,8 +241,8 @@ static void
|
|||
_e_fm_ipc_monitor_start_try(E_Fm_Task *task)
|
||||
{
|
||||
E_Dir *ed, *ped = NULL;
|
||||
Eina_Iterator *it;
|
||||
|
||||
DIR *dir;
|
||||
Eina_List *l;
|
||||
|
||||
/* look for any previous dir entries monitoring this dir */
|
||||
|
@ -257,8 +257,8 @@ _e_fm_ipc_monitor_start_try(E_Fm_Task *task)
|
|||
}
|
||||
|
||||
/* open the dir to list */
|
||||
dir = opendir(task->src);
|
||||
if (!dir)
|
||||
it = eina_file_direct_ls(task->src);
|
||||
if (!it)
|
||||
{
|
||||
char buf[PATH_MAX + 4096];
|
||||
|
||||
|
@ -267,11 +267,9 @@ _e_fm_ipc_monitor_start_try(E_Fm_Task *task)
|
|||
}
|
||||
else
|
||||
{
|
||||
Eina_File_Direct_Info *info;
|
||||
Eina_List *files = NULL;
|
||||
struct dirent *dp;
|
||||
int dot_order = 0;
|
||||
char buf[4096];
|
||||
FILE *f;
|
||||
char *dot_order = NULL;
|
||||
|
||||
/* create a new dir entry */
|
||||
ed = calloc(1, sizeof(E_Dir));
|
||||
|
@ -293,42 +291,66 @@ _e_fm_ipc_monitor_start_try(E_Fm_Task *task)
|
|||
_e_dirs = eina_list_append(_e_dirs, ed);
|
||||
|
||||
/* read everything except a .order, . and .. */
|
||||
while ((dp = readdir(dir)))
|
||||
EINA_ITERATOR_FOREACH(it, info)
|
||||
{
|
||||
if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, "..")))
|
||||
continue;
|
||||
if (!strcmp(dp->d_name, ".order"))
|
||||
if (!strcmp(info->path + info->name_start, ".order"))
|
||||
{
|
||||
dot_order = 1;
|
||||
dot_order = strdup(info->path);
|
||||
continue;
|
||||
}
|
||||
files = eina_list_append(files, strdup(dp->d_name));
|
||||
files = eina_list_append(files, eina_stringshare_add(info->path + info->name_start));
|
||||
}
|
||||
closedir(dir);
|
||||
eina_iterator_free(it);
|
||||
|
||||
/* if there was a .order - we need to parse it */
|
||||
if (dot_order)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/.order", task->src);
|
||||
f = fopen(buf, "r");
|
||||
if (f)
|
||||
{
|
||||
Eina_List *f2 = NULL;
|
||||
int len;
|
||||
char *s;
|
||||
Eina_File *f;
|
||||
|
||||
/* inset files in order if the existed in file
|
||||
* list before */
|
||||
while (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
len = strlen(buf);
|
||||
if (len > 0) buf[len - 1] = 0;
|
||||
s = _e_str_list_remove(&files, buf);
|
||||
if (s) f2 = eina_list_append(f2, s);
|
||||
}
|
||||
fclose(f);
|
||||
/* append whats left */
|
||||
files = eina_list_merge(f2, files);
|
||||
}
|
||||
f = eina_file_open(dot_order, EINA_FALSE);
|
||||
if (f)
|
||||
{
|
||||
Eina_List *f2 = NULL;
|
||||
char *map;
|
||||
|
||||
/* This piece of code should really become generic and work like an iterator.
|
||||
* I plan to add this feature in eina, but that would be for next generation of E,
|
||||
* not E17.
|
||||
*/
|
||||
map = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
|
||||
if (map)
|
||||
{
|
||||
const char *current = map;
|
||||
const char *found;
|
||||
size_t length = eina_file_size_get(f);
|
||||
|
||||
/* inset files in order if the existed in file
|
||||
* list before */
|
||||
while ((found = memchr(current, '\n', length)))
|
||||
{
|
||||
if (found - current > 1)
|
||||
{
|
||||
char *s = _e_str_list_remove(&files, current, found - current - 1);
|
||||
if (s) f2 = eina_list_append(f2, s);
|
||||
}
|
||||
length -= found - current - 1;
|
||||
current = found + 1;
|
||||
}
|
||||
|
||||
if (found == NULL && length > 0)
|
||||
{
|
||||
char *s = _e_str_list_remove(&files, current, length);
|
||||
if (s) f2 = eina_list_append(f2, s);
|
||||
}
|
||||
|
||||
/* append whats left */
|
||||
files = eina_list_merge(f2, files);
|
||||
|
||||
eina_file_map_free(f, map);
|
||||
}
|
||||
|
||||
eina_file_close(f);
|
||||
}
|
||||
}
|
||||
ed->fq = files;
|
||||
/* FIXME: if .order file- load it, sort all items int it
|
||||
|
@ -339,25 +361,23 @@ _e_fm_ipc_monitor_start_try(E_Fm_Task *task)
|
|||
* .order file stuff here - but not today
|
||||
*/
|
||||
/* note that we had a .order at all */
|
||||
ed->dot_order = dot_order;
|
||||
ed->dot_order = dot_order ? EINA_TRUE : EINA_FALSE;
|
||||
if (dot_order)
|
||||
{
|
||||
/* if we did - tell the E about this FIRST - it will
|
||||
* decide what to do if it first sees a .order or not */
|
||||
if (!strcmp(task->src, "/"))
|
||||
snprintf(buf, sizeof(buf), "/.order");
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s/.order", task->src);
|
||||
if (eina_list_count(files) == 1)
|
||||
_e_fm_ipc_file_add(ed, buf, 2);
|
||||
_e_fm_ipc_file_add(ed, dot_order, 2);
|
||||
else
|
||||
_e_fm_ipc_file_add(ed, buf, 1);
|
||||
_e_fm_ipc_file_add(ed, dot_order, 1);
|
||||
}
|
||||
/* send empty file - indicate empty dir */
|
||||
if (!files) _e_fm_ipc_file_add(ed, "", 2);
|
||||
/* and in an idler - list files, statting them etc. */
|
||||
ed->idler = ecore_idler_add(_e_fm_ipc_cb_file_mon_list_idler, ed);
|
||||
ed->sync_num = DEF_SYNC_NUM;
|
||||
|
||||
free(dot_order);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1148,7 +1168,7 @@ _e_fm_ipc_cb_file_mon_list_idler(void *data)
|
|||
snprintf(buf, sizeof(buf), "%s/%s", ed->dir, file);
|
||||
_e_fm_ipc_file_add(ed, buf, 1);
|
||||
}
|
||||
free(file);
|
||||
eina_stringshare_del(file);
|
||||
ed->fq = eina_list_remove_list(ed->fq, ed->fq);
|
||||
n++;
|
||||
if (n == ed->sync_num)
|
||||
|
@ -1251,13 +1271,13 @@ _e_fm_ipc_cb_fop_trash_idler(void *data)
|
|||
}
|
||||
|
||||
static char *
|
||||
_e_str_list_remove(Eina_List **list, char *str)
|
||||
_e_str_list_remove(Eina_List **list, const char *str, int len)
|
||||
{
|
||||
Eina_List *l;
|
||||
char *s;
|
||||
|
||||
EINA_LIST_FOREACH(*list, l, s)
|
||||
if (!strcmp(s, str))
|
||||
if (!strncmp(s, str, len))
|
||||
{
|
||||
*list = eina_list_remove_list(*list, l);
|
||||
return s;
|
||||
|
@ -1357,7 +1377,7 @@ _e_fm_ipc_dir_del(E_Dir *ed)
|
|||
free(m);
|
||||
}
|
||||
EINA_LIST_FREE(ed->fq, data)
|
||||
free(data);
|
||||
eina_stringshare_del(data);
|
||||
free(ed);
|
||||
}
|
||||
|
||||
|
|
|
@ -731,8 +731,7 @@ _e_fm_op_scan_idler(void *data __UNUSED__)
|
|||
static Eina_List *node = NULL;
|
||||
E_Fm_Op_Task *task = NULL;
|
||||
char buf[PATH_MAX];
|
||||
static struct dirent *de = NULL;
|
||||
static DIR *dir = NULL;
|
||||
static Eina_Iterator *dir = NULL;
|
||||
E_Fm_Op_Task *ntask = NULL;
|
||||
|
||||
if (!node) node = _e_fm_op_scan_queue;
|
||||
|
@ -780,7 +779,7 @@ _e_fm_op_scan_idler(void *data __UNUSED__)
|
|||
{
|
||||
/* If it's a dir, then look through it and add a task for each. */
|
||||
|
||||
dir = opendir(task->src.name);
|
||||
dir = eina_file_direct_ls(task->src.name);
|
||||
if (!dir)
|
||||
_E_FM_OP_ERROR_SEND_SCAN(task, E_FM_OP_ERROR,
|
||||
"Cannot open directory '%s': %s.",
|
||||
|
@ -797,9 +796,9 @@ _e_fm_op_scan_idler(void *data __UNUSED__)
|
|||
}
|
||||
else if (dir && !task->started)
|
||||
{
|
||||
de = readdir(dir);
|
||||
Eina_File_Direct_Info *info;
|
||||
|
||||
if (!de)
|
||||
if (!eina_iterator_next(dir, (void**) &info))
|
||||
{
|
||||
ntask = _e_fm_op_task_new();
|
||||
ntask->type = E_FM_OP_COPY_STAT_INFO;
|
||||
|
@ -819,23 +818,19 @@ _e_fm_op_scan_idler(void *data __UNUSED__)
|
|||
eina_list_append(_e_fm_op_scan_queue, ntask);
|
||||
|
||||
task->started = 1;
|
||||
closedir(dir);
|
||||
eina_iterator_free(dir);
|
||||
dir = NULL;
|
||||
node = NULL;
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
if ((!strcmp(de->d_name, ".") || (!strcmp(de->d_name, ".."))))
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
||||
ntask = _e_fm_op_task_new();
|
||||
ntask->type = task->type;
|
||||
snprintf(buf, sizeof(buf), "%s/%s", task->src.name, de->d_name);
|
||||
ntask->src.name = eina_stringshare_add(buf);
|
||||
ntask->src.name = eina_stringshare_add(info->path);
|
||||
|
||||
if (task->dst.name)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/%s", task->dst.name, de->d_name);
|
||||
snprintf(buf, sizeof(buf), "%s/%s", task->dst.name, info->path + info->name_start);
|
||||
ntask->dst.name = eina_stringshare_add(buf);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -21,7 +21,7 @@ struct _Info
|
|||
int iw, ih;
|
||||
Eina_List *dirs;
|
||||
char *curdir;
|
||||
DIR *dir;
|
||||
Eina_Iterator *dir;
|
||||
Ecore_Idler *idler;
|
||||
int scans;
|
||||
int con_num, zone_num, desk_x, desk_y;
|
||||
|
@ -1050,8 +1050,7 @@ _wp_changed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__
|
|||
static Eina_Bool
|
||||
_idler(void *data)
|
||||
{
|
||||
struct dirent *dp;
|
||||
char buf[PATH_MAX];
|
||||
Eina_File_Direct_Info *st;
|
||||
Info *info = data;
|
||||
|
||||
if (!info->dir)
|
||||
|
@ -1059,29 +1058,25 @@ _idler(void *data)
|
|||
info->idler = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
dp = readdir(info->dir);
|
||||
if (!dp)
|
||||
if (!eina_iterator_next(info->dir, (void**) &st))
|
||||
{
|
||||
free(info->curdir);
|
||||
info->curdir = NULL;
|
||||
closedir(info->dir);
|
||||
eina_iterator_free(info->dir);
|
||||
info->dir = NULL;
|
||||
info->idler = NULL;
|
||||
_scan(info);
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, "..")))
|
||||
if ((st->path[st->name_start]) == '.')
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
if (dp->d_name[0] == '.')
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
snprintf(buf, sizeof(buf), "%s/%s", info->curdir, dp->d_name);
|
||||
if (ecore_file_is_dir(buf))
|
||||
if (st->type == EINA_FILE_DIR)
|
||||
{
|
||||
info->dirs = eina_list_append(info->dirs, strdup(buf));
|
||||
info->dirs = eina_list_append(info->dirs, strdup(st->path));
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
info->scans++;
|
||||
_pan_file_add(info->span, buf, 0, 0);
|
||||
_pan_file_add(info->span, st->path, 0, 0);
|
||||
|
||||
e_util_wakeup();
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
@ -1102,7 +1097,7 @@ _scan(Info *info)
|
|||
if (info->curdir) free(info->curdir);
|
||||
info->curdir = info->dirs->data;
|
||||
info->dirs = eina_list_remove_list(info->dirs, info->dirs);
|
||||
if (!info->dir) info->dir = opendir(info->curdir);
|
||||
if (!info->dir) info->dir = eina_file_stat_ls(info->curdir);
|
||||
info->idler = ecore_idler_add(_idler, info);
|
||||
}
|
||||
}
|
||||
|
@ -1300,7 +1295,7 @@ wp_broser_free(Info *info)
|
|||
|
||||
if (!info) return;
|
||||
e_object_del(E_OBJECT(info->win));
|
||||
if (info->dir) closedir(info->dir);
|
||||
if (info->dir) eina_iterator_free(info->dir);
|
||||
free(info->bg_file);
|
||||
free(info->curdir);
|
||||
EINA_LIST_FREE(info->dirs, s)
|
||||
|
|
|
@ -2815,12 +2815,12 @@ _evry_matches_update(Evry_Selector *sel, int async)
|
|||
/* check if input matches plugin trigger */
|
||||
if (input)
|
||||
{
|
||||
int len_trigger = 0;
|
||||
size_t len_trigger = 0;
|
||||
|
||||
EINA_LIST_FOREACH (s->plugins, l, p)
|
||||
{
|
||||
if (!p->config->trigger) continue;
|
||||
int len = strlen(p->config->trigger);
|
||||
size_t len = strlen(p->config->trigger);
|
||||
|
||||
if (len_trigger && len != len_trigger)
|
||||
continue;
|
||||
|
@ -2884,7 +2884,7 @@ _evry_matches_update(Evry_Selector *sel, int async)
|
|||
|
||||
/* skip non-toplevel plugins when input < min_query */
|
||||
if ((!p->config->top_level) &&
|
||||
(p->config->min_query > len_inp))
|
||||
((size_t) p->config->min_query > len_inp))
|
||||
goto next;
|
||||
}
|
||||
|
||||
|
|
|
@ -224,9 +224,9 @@ struct _Evry_Event_Action_Performed
|
|||
|
||||
/* call free on all items provided by plugin instance '_p' */
|
||||
#define EVRY_PLUGIN_ITEMS_FREE(_p) { \
|
||||
Evry_Item *it; \
|
||||
EINA_LIST_FREE(EVRY_PLUGIN(_p)->items, it) \
|
||||
evry->item_free(it); }
|
||||
Evry_Item *_it; \
|
||||
EINA_LIST_FREE(EVRY_PLUGIN(_p)->items, _it) \
|
||||
evry->item_free(_it); }
|
||||
|
||||
/* append '_item' to list of items provided by plugin instance '_p' */
|
||||
#define EVRY_PLUGIN_ITEM_APPEND(_p, _item) \
|
||||
|
@ -255,9 +255,9 @@ struct _Evry_Event_Action_Performed
|
|||
(_input && (strlen(_input) >= EVRY_PLUGIN(_p)->config->min_query)))
|
||||
|
||||
#define EVRY_PLUGIN_ITEMS_CLEAR(_p) { \
|
||||
Evry_Item *it; \
|
||||
EINA_LIST_FREE(EVRY_PLUGIN(_p)->items, it) \
|
||||
if (it) it->fuzzy_match = 0; }
|
||||
Evry_Item *_it; \
|
||||
EINA_LIST_FREE(EVRY_PLUGIN(_p)->items, _it) \
|
||||
if (_it) _it->fuzzy_match = 0; }
|
||||
|
||||
#define EVRY_PLUGIN_HAS_ITEMS(_p) !!(EVRY_PLUGIN(_p)->items)
|
||||
|
||||
|
@ -273,9 +273,9 @@ struct _Evry_Event_Action_Performed
|
|||
_module = E_NEW(Evry_Module, 1); \
|
||||
_module->init = &_init; \
|
||||
_module->shutdown = &_shutdown; \
|
||||
Eina_List *l = e_datastore_get("evry_modules"); \
|
||||
l = eina_list_append(l, _module); \
|
||||
e_datastore_set("evry_modules", l); \
|
||||
Eina_List *_l = e_datastore_get("evry_modules"); \
|
||||
_l = eina_list_append(_l, _module); \
|
||||
e_datastore_set("evry_modules", _l); \
|
||||
if ((_evry = e_datastore_get("evry_api"))) \
|
||||
_module->active = _init(_evry); \
|
||||
}
|
||||
|
@ -284,9 +284,9 @@ struct _Evry_Event_Action_Performed
|
|||
{ \
|
||||
if (_module->active) _module->shutdown(); \
|
||||
_module->active = EINA_FALSE; \
|
||||
Eina_List *l = e_datastore_get("evry_modules"); \
|
||||
l = eina_list_remove(l, _module); \
|
||||
if (l) e_datastore_set("evry_modules", l); \
|
||||
Eina_List *_l = e_datastore_get("evry_modules"); \
|
||||
_l = eina_list_remove(_l, _module); \
|
||||
if (_l) e_datastore_set("evry_modules", _l); \
|
||||
else e_datastore_del("evry_modules"); \
|
||||
E_FREE(_module); \
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ static Eina_List *exe_path = NULL;
|
|||
static Ecore_Idler *exe_scan_idler = NULL;
|
||||
static E_Config_DD *exelist_exe_edd = NULL;
|
||||
static E_Config_DD *exelist_edd = NULL;
|
||||
static DIR *exe_dir = NULL;
|
||||
static Eina_Iterator *exe_dir = NULL;
|
||||
static Eina_List *exe_list = NULL;
|
||||
static Eina_List *exe_list2 = NULL;
|
||||
static Eina_List *apps_cache = NULL;
|
||||
|
@ -231,7 +231,7 @@ _fetch_exe(Evry_Plugin *plugin, const char *input)
|
|||
{
|
||||
GET_PLUGIN(p, plugin);
|
||||
Eina_List *l;
|
||||
Evry_Item *it;
|
||||
Evry_Item *eit;
|
||||
History_Types *ht;
|
||||
unsigned int len = (input ? strlen(input) : 0);
|
||||
double max = 0.0;
|
||||
|
@ -291,11 +291,11 @@ _fetch_exe(Evry_Plugin *plugin, const char *input)
|
|||
}
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH (plugin->items, l, it)
|
||||
EINA_LIST_FOREACH (plugin->items, l, eit)
|
||||
{
|
||||
evry->history_item_usage_set(it, input, NULL);
|
||||
if (input && (it->usage > max) && !strncmp(input, it->label, len))
|
||||
max = it->usage;
|
||||
evry->history_item_usage_set(eit, input, NULL);
|
||||
if (input && (eit->usage > max) && !strncmp(input, eit->label, len))
|
||||
max = eit->usage;
|
||||
}
|
||||
EVRY_ITEM(p->command)->usage = (max * 2.0);
|
||||
|
||||
|
@ -340,7 +340,7 @@ _finish_exe(Evry_Plugin *plugin)
|
|||
|
||||
if (exe_dir)
|
||||
{
|
||||
closedir(exe_dir);
|
||||
eina_iterator_free(exe_dir);
|
||||
exe_dir = NULL;
|
||||
}
|
||||
EINA_LIST_FREE (exe_path, str)
|
||||
|
@ -1439,17 +1439,12 @@ evry_plug_apps_save(void)
|
|||
static Eina_Bool
|
||||
_scan_idler(void *data __UNUSED__)
|
||||
{
|
||||
struct stat st;
|
||||
struct dirent *dp;
|
||||
char *dir;
|
||||
char buf[4096];
|
||||
|
||||
/* no more path items left - stop scanning */
|
||||
if (!exe_path)
|
||||
{
|
||||
Eina_List *l, *l2;
|
||||
E_Exe_List *el;
|
||||
E_Exe *ee;
|
||||
int different = 0;
|
||||
|
||||
/* FIXME: check wheter they match or not */
|
||||
|
@ -1464,39 +1459,41 @@ _scan_idler(void *data __UNUSED__)
|
|||
if ((l) || (l2)) different = 1;
|
||||
if (exe_list2)
|
||||
{
|
||||
while (exe_list)
|
||||
{
|
||||
free(eina_list_data_get(exe_list));
|
||||
exe_list = eina_list_remove_list(exe_list, exe_list);
|
||||
}
|
||||
void *tmp;
|
||||
|
||||
EINA_LIST_FREE(exe_list, tmp)
|
||||
free(tmp);
|
||||
exe_list = exe_list2;
|
||||
exe_list2 = NULL;
|
||||
}
|
||||
if (different)
|
||||
{
|
||||
const char *s;
|
||||
E_Exe_List *el;
|
||||
E_Exe *ee;
|
||||
|
||||
el = calloc(1, sizeof(E_Exe_List));
|
||||
if (el)
|
||||
if (!el) return ECORE_CALLBACK_CANCEL;
|
||||
|
||||
el->list = NULL;
|
||||
|
||||
EINA_LIST_FOREACH(exe_list, l, s)
|
||||
{
|
||||
el->list = NULL;
|
||||
for (l = exe_list; l; l = l->next)
|
||||
{
|
||||
ee = malloc(sizeof(E_Exe));
|
||||
if (ee)
|
||||
{
|
||||
ee->path = eina_stringshare_add(l->data);
|
||||
el->list = eina_list_append(el->list, ee);
|
||||
}
|
||||
}
|
||||
e_config_domain_save("exebuf_exelist_cache", exelist_edd, el);
|
||||
while (el->list)
|
||||
{
|
||||
ee = eina_list_data_get(el->list);
|
||||
eina_stringshare_del(ee->path);
|
||||
free(ee);
|
||||
el->list = eina_list_remove_list(el->list, el->list);
|
||||
}
|
||||
free(el);
|
||||
ee = malloc(sizeof(E_Exe));
|
||||
if (!ee) continue ;
|
||||
|
||||
ee->path = eina_stringshare_add(s);
|
||||
el->list = eina_list_append(el->list, ee);
|
||||
}
|
||||
|
||||
e_config_domain_save("exebuf_exelist_cache", exelist_edd, el);
|
||||
|
||||
EINA_LIST_FREE(el->list, ee)
|
||||
{
|
||||
eina_stringshare_del(ee->path);
|
||||
free(ee);
|
||||
}
|
||||
free(el);
|
||||
}
|
||||
exe_scan_idler = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
|
@ -1505,28 +1502,25 @@ _scan_idler(void *data __UNUSED__)
|
|||
if (!exe_dir)
|
||||
{
|
||||
dir = exe_path->data;
|
||||
exe_dir = opendir(dir);
|
||||
exe_dir = eina_file_direct_ls(dir);
|
||||
}
|
||||
/* if we have an opened dir - scan the next item */
|
||||
if (exe_dir)
|
||||
{
|
||||
dir = exe_path->data;
|
||||
Eina_File_Direct_Info *info;
|
||||
|
||||
dp = readdir(exe_dir);
|
||||
if (dp)
|
||||
if (eina_iterator_next(exe_dir, (void**) &info))
|
||||
{
|
||||
if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, "..")))
|
||||
Eina_Stat st;
|
||||
|
||||
if (eina_file_statat(eina_iterator_container_get(exe_dir), info, &st) &&
|
||||
(!S_ISDIR(st.mode)) &&
|
||||
(!access(info->path, X_OK)))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/%s", dir, dp->d_name);
|
||||
if ((stat(buf, &st) == 0) &&
|
||||
((!S_ISDIR(st.st_mode)) &&
|
||||
(!access(buf, X_OK))))
|
||||
{
|
||||
if (!exe_list)
|
||||
exe_list = eina_list_append(exe_list, strdup(dp->d_name));
|
||||
else
|
||||
exe_list2 = eina_list_append(exe_list2, strdup(dp->d_name));
|
||||
}
|
||||
if (!exe_list)
|
||||
exe_list = eina_list_append(exe_list, strdup(info->path + info->name_start));
|
||||
else
|
||||
exe_list2 = eina_list_append(exe_list2, strdup(info->path + info->name_start));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1535,9 +1529,12 @@ _scan_idler(void *data __UNUSED__)
|
|||
* of the path list so we advance and next loop we will pick up
|
||||
* the next item, or if null- abort
|
||||
*/
|
||||
closedir(exe_dir);
|
||||
dir = exe_path->data;
|
||||
free(dir);
|
||||
|
||||
eina_iterator_free(exe_dir);
|
||||
exe_dir = NULL;
|
||||
free(eina_list_data_get(exe_path));
|
||||
|
||||
exe_path = eina_list_remove_list(exe_path, exe_path);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue