* ecore: Fix ecore_file_dir_get.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 18 Jan 2010 11:05:03 +0000 (11:05 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 18 Jan 2010 11:05:03 +0000 (11:05 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@45283 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_file/ecore_file.c

index 9c811a3..1bfcaee 100644 (file)
@@ -13,6 +13,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <dirent.h>
+#include <libgen.h>
 
 #ifndef _FILE_OFFSET_BITS
 # define _FILE_OFFSET_BITS  64
@@ -600,13 +601,8 @@ ecore_file_dir_get(const char *file)
    char buf[PATH_MAX];
 
    strncpy(buf, file, PATH_MAX);
-   p = strrchr(buf, '/');
-   if (!p) return strdup(file);
-
-   if (p == buf) return strdup("/");
-
-   *p = 0;
-   return strdup(buf);
+   p = dirname(buf);
+   return strdup(p);
 }
 
 /**