oops - yes - windows. ugh. indeed.
authorCarsten Haitzler <raster@rasterman.com>
Mon, 15 Oct 2012 08:00:31 +0000 (08:00 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Mon, 15 Oct 2012 08:00:31 +0000 (08:00 +0000)
SVN revision: 77985

legacy/ecore/AUTHORS
legacy/ecore/src/lib/ecore_file/ecore_file.c

index 22a8974..2de0ab8 100644 (file)
@@ -56,4 +56,3 @@ Seong-ho Cho (DarkCircle) <darkcircle.0426@gmail.com>
 Patryk Kaczmarek <patryk.k@samsung.com>
 Daniel Willmann <d.willmann@samsung.com>
 Michal Pakula vel Rutka <m.pakula@samsung.com>
-Maxime Villard <rustyBSD@gmx.fr>
index 3096506..c59bf80 100644 (file)
@@ -399,16 +399,21 @@ 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;
 
-   if (lstat(dir, &st) == -1)
-     return EINA_FALSE;
+   if (readlink(dir, buf, sizeof(buf) - 1) > 0)
+     return ecore_file_unlink(dir);
 
-   if (S_ISDIR(st.st_mode))
+   ret = stat(dir, &st);
+   if ((ret == 0) && (S_ISDIR(st.st_mode)))
      {
         Eina_File_Direct_Info *info;
-        Eina_Iterator *it;
-        int ret = 1;
+
+        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)
@@ -424,8 +429,11 @@ ecore_file_recursive_rm(const char *dir)
         else
             return EINA_FALSE;
      }
-
-   return ecore_file_unlink(dir);
+   else
+     {
+        if (ret == -1) return EINA_FALSE;
+        return ecore_file_unlink(dir);
+     }
 }
 
 static inline Eina_Bool
@@ -782,7 +790,7 @@ EAPI char *
 ecore_file_readlink(const char *lnk)
 {
    char buf[PATH_MAX];
-   ssize_t count;
+   int count;
 
    if ((count = readlink(lnk, buf, sizeof(buf) - 1)) < 0) return NULL;
    buf[count] = 0;