glib r6759 - branches/glib-2-16/gio



Author: alexl
Date: Thu Mar 27 20:14:05 2008
New Revision: 6759
URL: http://svn.gnome.org/viewvc/glib?rev=6759&view=rev

Log:
2008-03-27  Alexander Larsson  <alexl redhat com>

	Merge from trunk:

	* glocalfile.c (g_local_file_move):
	Return G_IO_ERROR_IS_DIRECTORY, not G_IO_ERROR_WOULD_MERGE when moving
	file over directory. This is according to the docs and what the move via
	copy+remove fallback does.



Modified:
   branches/glib-2-16/gio/ChangeLog
   branches/glib-2-16/gio/glocalfile.c

Modified: branches/glib-2-16/gio/glocalfile.c
==============================================================================
--- branches/glib-2-16/gio/glocalfile.c	(original)
+++ branches/glib-2-16/gio/glocalfile.c	Thu Mar 27 20:14:05 2008
@@ -2078,9 +2078,8 @@
 		   g_strerror (errsv));
       return FALSE;
     }
-  else
-    source_is_dir = S_ISDIR (statbuf.st_mode);
 
+  source_is_dir = S_ISDIR (statbuf.st_mode);
   source_size = statbuf.st_size;
   
   destination_exist = FALSE;
@@ -2094,10 +2093,16 @@
 	  /* Always fail on dirs, even with overwrite */
 	  if (S_ISDIR (statbuf.st_mode))
 	    {
-	      g_set_error (error,
-			   G_IO_ERROR,
-			   G_IO_ERROR_WOULD_MERGE,
-			   _("Can't move directory over directory"));
+	      if (source_is_dir)
+		g_set_error (error,
+			     G_IO_ERROR,
+			     G_IO_ERROR_WOULD_MERGE,
+			     _("Can't move directory over directory"));
+              else
+		g_set_error (error,
+			     G_IO_ERROR,
+			     G_IO_ERROR_IS_DIRECTORY,
+			     _("File is directory"));
 	      return FALSE;
 	    }
 	}



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