summaryrefslogtreecommitdiff
path: root/src/lib/ecore_file
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2018-01-27 15:17:17 +0100
committerJean-Philippe Andre <jp.andre@samsung.com>2018-01-30 16:52:24 +0900
commitef0f0a50b2912f442f14dc2ba3c071b7122faf6e (patch)
tree40b8f9b970f72167db45f0f7aed7c33a7f706a7d /src/lib/ecore_file
parentd7170beb76d6b3a96142d3d4750afdb7fdb7d4fa (diff)
Ecore_File: remove symlinks support on Windows (library and test)
Diffstat (limited to 'src/lib/ecore_file')
-rw-r--r--src/lib/ecore_file/Ecore_File.h14
-rw-r--r--src/lib/ecore_file/ecore_file.c18
2 files changed, 19 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);
319 * @param dest The name of link. 319 * @param dest The name of link.
320 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. 320 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
321 * 321 *
322 * This function create the symbolic link @p dest of @p src. This 322 * This function creates the symbolic link @p dest of @p src. It returns
323 * function does not work on Windows. It returns @c EINA_TRUE on success, 323 * @c EINA_TRUE on success, @c EINA_FALSE otherwise.
324 * @c EINA_FALSE otherwise. 324 *
325 * @note On windows, this function always returns @c EINA_FALSE.
325 */ 326 */
326EAPI Eina_Bool ecore_file_symlink (const char *src, const char *dest); 327EAPI Eina_Bool ecore_file_symlink (const char *src, const char *dest);
327 328
@@ -426,9 +427,10 @@ EAPI Eina_Bool ecore_file_can_exec (const char *file);
426 * @return The path pointed by link or NULL. 427 * @return The path pointed by link or NULL.
427 * 428 *
428 * This function returns the path pointed by @p link as a newly 429 * This function returns the path pointed by @p link as a newly
429 * allocated string. This function does not work on Windows. On 430 * allocated string. On failure, the function returns @c NULL. When not
430 * failure, the function returns @c NULL. When not needed anymore, the 431 * needed anymore, the returned value must be freed.
431 * returned value must be freed. 432 *
433 * @note On windows, this function always returns @c NULL.
432 */ 434 */
433EAPI char *ecore_file_readlink (const char *link); 435EAPI char *ecore_file_readlink (const char *link);
434 436
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)
320 Eina_Bool is_dir; 320 Eina_Bool is_dir;
321 321
322#ifdef _WIN32 322#ifdef _WIN32
323 char buf[PATH_MAX];
324
325 if (readlink(dir, buf, sizeof(buf) - 1) > 0)
326 return ecore_file_unlink(dir);
327
328 if (!_ecore_file_stat(dir, NULL, NULL, NULL, &is_dir, NULL)) 323 if (!_ecore_file_stat(dir, NULL, NULL, NULL, &is_dir, NULL))
329 return EINA_FALSE; 324 return EINA_FALSE;
330#else 325#else
@@ -545,9 +540,13 @@ FAIL:
545EAPI Eina_Bool 540EAPI Eina_Bool
546ecore_file_symlink(const char *src, const char *dest) 541ecore_file_symlink(const char *src, const char *dest)
547{ 542{
548 if (!symlink(src, dest)) return EINA_TRUE; 543#ifndef _WIN32
549 544 return !symlink(src, dest);
545#else
550 return EINA_FALSE; 546 return EINA_FALSE;
547 (void)src;
548 (void)dest;
549#endif
551} 550}
552 551
553EAPI char * 552EAPI char *
@@ -630,12 +629,17 @@ ecore_file_can_exec(const char *file)
630EAPI char * 629EAPI char *
631ecore_file_readlink(const char *link) 630ecore_file_readlink(const char *link)
632{ 631{
632#ifndef _WIN32
633 char buf[PATH_MAX]; 633 char buf[PATH_MAX];
634 int count; 634 int count;
635 635
636 if ((count = readlink(link, buf, sizeof(buf) - 1)) < 0) return NULL; 636 if ((count = readlink(link, buf, sizeof(buf) - 1)) < 0) return NULL;
637 buf[count] = 0; 637 buf[count] = 0;
638 return strdup(buf); 638 return strdup(buf);
639#else
640 return NULL;
641 (void)link;
642#endif
639} 643}
640 644
641EAPI Eina_List * 645EAPI Eina_List *