jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ef0f0a50b2912f442f14dc2ba3c071b7122faf6e

commit ef0f0a50b2912f442f14dc2ba3c071b7122faf6e
Author: Vincent Torri <vincent.to...@gmail.com>
Date:   Sat Jan 27 15:17:17 2018 +0100

    Ecore_File: remove symlinks support on Windows (library and test)
---
 src/lib/ecore_file/Ecore_File.h         | 14 ++++++++------
 src/lib/ecore_file/ecore_file.c         | 18 +++++++++++-------
 src/tests/ecore/ecore_test_ecore_file.c |  3 +++
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/lib/ecore_file/Ecore_File.h b/src/lib/ecore_file/Ecore_File.h
index 39f0f7ecae..50c85eaa7e 100644
--- a/src/lib/ecore_file/Ecore_File.h
+++ b/src/lib/ecore_file/Ecore_File.h
@@ -319,9 +319,10 @@ EAPI Eina_Bool      ecore_file_mv           (const char 
*src, const char *dst);
  * @param  dest The name of link.
  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
  *
- * This function create the symbolic link @p dest of @p src. This
- * function does not work on Windows. It returns @c EINA_TRUE on success,
- * @c EINA_FALSE otherwise.
+ * This function creates the symbolic link @p dest of @p src. It returns
+ * @c EINA_TRUE on success, @c EINA_FALSE otherwise.
+ *
+ * @note On windows, this function always returns @c EINA_FALSE.
  */
 EAPI Eina_Bool      ecore_file_symlink      (const char *src, const char 
*dest);
 
@@ -426,9 +427,10 @@ EAPI Eina_Bool      ecore_file_can_exec     (const char 
*file);
  * @return The path pointed by link or NULL.
  *
  * This function returns the path pointed by @p link as a newly
- * allocated string. This function does not work on Windows. On
- * failure, the function returns @c NULL. When not needed anymore, the
- * returned value must be freed.
+ * allocated string. On failure, the function returns @c NULL. When not
+ * needed anymore, the returned value must be freed.
+ *
+ * @note On windows, this function always returns @c NULL.
  */
 EAPI char          *ecore_file_readlink     (const char *link);
 
diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c
index 15d96edb6e..89b6f2b373 100644
--- a/src/lib/ecore_file/ecore_file.c
+++ b/src/lib/ecore_file/ecore_file.c
@@ -320,11 +320,6 @@ ecore_file_recursive_rm(const char *dir)
    Eina_Bool is_dir;
 
 #ifdef _WIN32
-   char buf[PATH_MAX];
-
-   if (readlink(dir, buf, sizeof(buf) - 1) > 0)
-     return ecore_file_unlink(dir);
-
    if (!_ecore_file_stat(dir, NULL, NULL, NULL, &is_dir, NULL))
      return EINA_FALSE;
 #else
@@ -545,9 +540,13 @@ FAIL:
 EAPI Eina_Bool
 ecore_file_symlink(const char *src, const char *dest)
 {
-   if (!symlink(src, dest)) return EINA_TRUE;
-
+#ifndef _WIN32
+   return !symlink(src, dest);
+#else
    return EINA_FALSE;
+   (void)src;
+   (void)dest;
+#endif
 }
 
 EAPI char *
@@ -630,12 +629,17 @@ ecore_file_can_exec(const char *file)
 EAPI char *
 ecore_file_readlink(const char *link)
 {
+#ifndef _WIN32
    char buf[PATH_MAX];
    int count;
 
    if ((count = readlink(link, buf, sizeof(buf) - 1)) < 0) return NULL;
    buf[count] = 0;
    return strdup(buf);
+#else
+   return NULL;
+   (void)link;
+#endif
 }
 
 EAPI Eina_List *
diff --git a/src/tests/ecore/ecore_test_ecore_file.c 
b/src/tests/ecore/ecore_test_ecore_file.c
index b393e74199..b5f157f571 100644
--- a/src/tests/ecore/ecore_test_ecore_file.c
+++ b/src/tests/ecore/ecore_test_ecore_file.c
@@ -215,12 +215,15 @@ START_TEST(ecore_test_ecore_file_operations)
    res = ecore_file_remove(dest_file);
    fail_if(res != EINA_TRUE);
 
+   /* On Windows, symlink/readlink are not supported */
+#ifndef _WIN32
    res = ecore_file_symlink(src_file, dest_file);
    fail_if(res != EINA_TRUE);
    ck_assert_str_eq(ecore_file_readlink(dest_file), src_file);
    ck_assert_str_eq(ecore_file_realpath(dest_file), src_file);
    res = ecore_file_unlink(dest_file);
    fail_if(res != EINA_TRUE);
+#endif
 
    dest_file = get_tmp_file();
    fail_if(!dest_file);

-- 


Reply via email to