[gvfs/gnome-2-32] afc: Fix renaming files moving them to the root dir



commit 6282ea2d0aebf0692aca8de22f8733d1ec109711
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Mar 24 11:46:32 2011 +0000

    afc: Fix renaming files moving them to the root dir
    
    We were moving and renaming files, instead of just renaming them,
    as the display_name wasn't properly rooted to the existing directory.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=638191

 daemon/gvfsbackendafc.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index ae266c4..0379847 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -1386,19 +1386,28 @@ g_vfs_backend_afc_set_display_name (GVfsBackend *backend,
                                     const char *display_name)
 {
   GVfsBackendAfc *self;
+  char *new_path;
+  char *dirname;
 
   self = G_VFS_BACKEND_AFC(backend);
   g_return_if_fail (self->connected);
 
+  dirname = g_path_get_dirname (filename);
+  new_path = g_build_filename (dirname, display_name, NULL);
+  g_free (dirname);
+
   if (G_UNLIKELY(g_vfs_backend_afc_check (afc_rename_path (self->afc_cli,
-                                                           filename, display_name),
+                                                           filename, new_path),
                                           G_VFS_JOB(job))))
     {
+      g_free (new_path);
       return;
     }
 
   g_vfs_job_set_display_name_set_new_path (job, display_name);
 
+  g_free (new_path);
+
   g_vfs_job_succeeded (G_VFS_JOB(job));
 }
 



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