ecore_file: fix ecore_file_file_get() on Windows
authorVincent Torri <vincent dot torri at gmail dot com>
Thu, 15 Oct 2015 12:36:17 +0000 (14:36 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Tue, 1 Dec 2015 19:35:24 +0000 (11:35 -0800)
@fix

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/ecore_file/ecore_file.c

index 07d247b..52d203e 100644 (file)
@@ -29,7 +29,6 @@
 
 /*
  * FIXME: the following functions will certainly not work on Windows:
- * ecore_file_file_get()
  * ecore_file_app_exe_get()
  * ecore_file_escape_name()
  */
@@ -773,6 +772,23 @@ ecore_file_file_get(const char *path)
    char *result = NULL;
 
    if (!path) return NULL;
+
+#ifdef _WIN32
+   {
+     char buf[MAX_PATH];
+
+     memcpy(buf, path, strlen(path) + 1);
+     EVIL_PATH_SEP_UNIX_TO_WIN32(buf);
+     if ((result = strrchr(buf, '\\')))
+       {
+          result++;
+          return path + (result - buf);
+       }
+     else
+       return path;
+   }
+#endif
+
    if ((result = strrchr(path, '/'))) result++;
    else result = (char *)path;