gvfs r1571 - in trunk: . daemon



Author: otte
Date: Thu Mar  6 09:23:32 2008
New Revision: 1571
URL: http://svn.gnome.org/viewvc/gvfs?rev=1571&view=rev

Log:
2008-03-06  Benjamin Otte  <otte gnome org>

	* daemon/gvfsbackendftp.c: (do_move):
	fail if file exists



Modified:
   trunk/ChangeLog
   trunk/daemon/gvfsbackendftp.c

Modified: trunk/daemon/gvfsbackendftp.c
==============================================================================
--- trunk/daemon/gvfsbackendftp.c	(original)
+++ trunk/daemon/gvfsbackendftp.c	Thu Mar  6 09:23:32 2008
@@ -2107,7 +2107,19 @@
 
   if (!(flags & G_FILE_COPY_OVERWRITE))
     {
-      /* FIXME: check if file exists */
+      char *destfilename = ftp_filename_to_gvfs_path (conn, destfile);
+      GFileInfo *info = create_file_info (ftp, conn, destfilename, NULL);
+
+      g_free (destfilename);
+      if (info)
+	{
+	  g_object_unref (info);
+	  g_set_error (&conn->error,
+		       G_IO_ERROR,
+	               G_IO_ERROR_EXISTS,
+		       _("Target file already exists"));
+	  goto out;
+	}
     }
 
   ftp_connection_send (conn,
@@ -2117,6 +2129,7 @@
 		       0,
 		       "RNTO %s", destfile);
 
+out:
   g_free (srcfile);
   g_free (destfile);
   g_vfs_backend_ftp_push_connection (ftp, conn);



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