trash problem with symlinked homes



If your home directory is a symlink to a directory on another device,
trash doesn't currently work, since we're looking for the trash on the
device the symlink is stored on. The following patch fixes this, ok to
commit?

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-vfs/ChangeLog,v
retrieving revision 1.1768
diff -u -p -r1.1768 ChangeLog
--- ChangeLog	10 Mar 2004 12:21:05 -0000	1.1768
+++ ChangeLog	10 Mar 2004 13:37:36 -0000
@@ -1,5 +1,11 @@
 2004-03-10  Alexander Larsson  <alexl redhat com>
 
+	* libgnomevfs/gnome-vfs-cancellable-ops.c
+	(gnome_vfs_find_directory_cancellable):
+	For NULL near_uri, expand home dir if symlink.
+	
+2004-03-10  Alexander Larsson  <alexl redhat com>
+
 	* libgnomevfs/gnome-vfs-private-utils.[ch]
 	(gnome_vfs_process_run_cancellable):
 	Use correct return type.
Index: libgnomevfs/gnome-vfs-cancellable-ops.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-cancellable-ops.c,v
retrieving revision 1.30
diff -u -p -r1.30 gnome-vfs-cancellable-ops.c
--- libgnomevfs/gnome-vfs-cancellable-ops.c	8 Jul 2003 07:54:56 -0000	1.30
+++ libgnomevfs/gnome-vfs-cancellable-ops.c	10 Mar 2004 13:37:36 -0000
@@ -28,6 +28,7 @@
 #include <config.h>
 #include "gnome-vfs-cancellable-ops.h"
 #include "gnome-vfs-method.h"
+#include "gnome-vfs-private-utils.h"
 #include "gnome-vfs-handle-private.h"
 
 #include <glib/gmessages.h>
@@ -266,6 +267,7 @@ gnome_vfs_find_directory_cancellable (Gn
 				      GnomeVFSContext *context)
 {
 	GnomeVFSResult result;
+	GnomeVFSURI *resolved_uri;
 
 	g_return_val_if_fail (result_uri != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS);
 
@@ -277,6 +279,14 @@ gnome_vfs_find_directory_cancellable (Gn
 	} else {
 		/* assume file: method and the home directory */
 		near_uri = gnome_vfs_uri_new (g_get_home_dir());
+		/* Need to expand the final symlink, since if the homedir is a symlink
+		 * we want to look at the device the home symlink points to, not the
+		 * one the symlink is stored on */
+		if (_gnome_vfs_uri_resolve_all_symlinks_uri (near_uri,
+							     &resolved_uri) == GNOME_VFS_OK) {
+			gnome_vfs_uri_unref (near_uri);
+			near_uri = resolved_uri;
+		}
 	}
 
 	g_assert (near_uri != NULL);


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a world-famous guitar-strumming romance novelist on his last day in the 
job. She's a transdimensional streetsmart fairy princess trying to make a 
difference in a man's world. They fight crime! 




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