Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_file


Modified Files:
        ecore_file.c 


Log Message:


make mv copy if it is a regular file not on same fs.

===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/ecore_file.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- ecore_file.c        1 Feb 2007 19:22:35 -0000       1.53
+++ ecore_file.c        4 Feb 2007 13:14:16 -0000       1.54
@@ -3,6 +3,7 @@
  */
 #include <ctype.h>
 #include "ecore_file_private.h"
+#include <errno.h>
 
 
 static int init = 0;
@@ -204,15 +205,30 @@
 ecore_file_mv(const char *src, const char *dst)
 {
    if (ecore_file_exists(dst)) return 0;
-   if (rename(src, dst)) return 0;
+   if (rename(src, dst))
+     {
+       if (errno == EXDEV)
+         {
+            struct stat st;
+            
+            stat(src, &st);
+            if (S_ISREG(st.st_mode))
+              {
+                 ecore_file_cp(src, dst);
+                 chmod(dst, st.st_mode);
+                 ecore_file_unlink(src);
+                 return 1;
+              }
+         }
+       return 0;
+     }
    return 1;
 }
 
 EAPI int
 ecore_file_symlink(const char *src, const char *dest)
 {
-   if(!symlink(src, dest))
-     return 1;
+   if (!symlink(src, dest)) return 1;
    return 0;
 }
 



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to