MoveFileW fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As explained on the wine-devel list moving of files to a different volume was 
broken in Wine. According to MSDN this is allowed. This patch fixes that 
problem.

The other thing it fixes is that it now allows moves of directories as long as 
the directories stay on the same volume. Before no directory moves were 
allowed. 


Roderick Colenbrander

ChangeLog:
- moving of files to different volumes
- moving of directories on the same volume

Index: files/file.c
===================================================================
RCS file: /home/wine/wine/files/file.c,v
retrieving revision 1.177
diff -u -r1.177 file.c
--- files/file.c	11 Jan 2003 21:03:18 -0000	1.177
+++ files/file.c	25 Feb 2003 15:59:04 -0000
@@ -2840,19 +2840,26 @@
     }
     if (!DOSFS_GetFullName( fn2, FALSE, &full_name2 )) return FALSE;
 
-    if (full_name1.drive == full_name2.drive) /* move */
-        return MoveFileExW( fn1, fn2, MOVEFILE_COPY_ALLOWED );
-
-    /* copy */
-    if (stat( full_name1.long_name, &fstat ))
+    if (stat( full_name1.long_name, &fstat) )
     {
         WARN("Invalid source file %s\n",
              full_name1.long_name);
         FILE_SetDosError();
         return FALSE;
     }
+    
+    /* Allow all types of filemoves */
+    if (!S_ISDIR(fstat.st_mode))
+        return MoveFileExW( fn1, fn2, MOVEFILE_COPY_ALLOWED );
+
     if (S_ISDIR(fstat.st_mode)) {
-        /* No Move for directories across file systems */
+
+	/* According to MSDN, moves for directories are allowed */
+	/* as long as they happen on the same volume */
+	if(full_name1.drive == full_name2.drive)
+    	    return MoveFileExW( fn1, fn2, MOVEFILE_COPY_ALLOWED );
+
+        /* No Move for directories across different volumes */
         /* FIXME: Use right error code */
         SetLastError( ERROR_GEN_FAILURE );
         return FALSE;


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux