forked from enlightenment/efl
remove unnecessary stat calls in recursive_rm, patch by Maxime Villard
this patch didn't come with any changelog/news updates, so I'm assuming it's trivial enough to not need them or any backporting. someone else can take care of that if this is not the case. SVN revision: 78642
This commit is contained in:
parent
da39b6c326
commit
887c2a1190
|
@ -399,22 +399,27 @@ ecore_file_remove(const char *file)
|
|||
EAPI Eina_Bool
|
||||
ecore_file_recursive_rm(const char *dir)
|
||||
{
|
||||
Eina_Iterator *it;
|
||||
char buf[PATH_MAX];
|
||||
struct stat st;
|
||||
int ret;
|
||||
|
||||
#ifdef _WIN32
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if (readlink(dir, buf, sizeof(buf) - 1) > 0)
|
||||
return ecore_file_unlink(dir);
|
||||
if (stat(dir, &st) == -1)
|
||||
return EINA_FALSE;
|
||||
#else
|
||||
if (lstat(dir, &st) == -1)
|
||||
return EINA_FALSE;
|
||||
#endif
|
||||
|
||||
ret = stat(dir, &st);
|
||||
if ((ret == 0) && (S_ISDIR(st.st_mode)))
|
||||
if (S_ISDIR(st.st_mode))
|
||||
{
|
||||
Eina_File_Direct_Info *info;
|
||||
Eina_Iterator *it;
|
||||
int ret;
|
||||
|
||||
ret = 1;
|
||||
if (stat(dir, &st) == -1) return EINA_FALSE; /* WOOT: WHY ARE WE CALLING STAT TWO TIMES ??? */
|
||||
|
||||
it = eina_file_direct_ls(dir);
|
||||
EINA_ITERATOR_FOREACH(it, info)
|
||||
{
|
||||
|
@ -431,7 +436,6 @@ ecore_file_recursive_rm(const char *dir)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (ret == -1) return EINA_FALSE;
|
||||
return ecore_file_unlink(dir);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue