Index: ftp-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/ftp-method.c,v
retrieving revision 1.106
diff -u -r1.106 ftp-method.c
--- ftp-method.c	31 Jul 2004 16:34:34 -0000	1.106
+++ ftp-method.c	12 Aug 2004 18:25:15 -0000
@@ -586,6 +586,8 @@
 
 	if (path == NULL || path[0] == '\0') {
 		actual_command = g_strconcat (command, " /", NULL);
+	} else if( ! strncmp( "/~", path, 2 ) ) {
+		actual_command = g_strconcat (command, " ", path + 1, NULL);
 	} else {
 		actual_command = g_strconcat (command, " ", path, NULL);
 	}
@@ -722,24 +724,37 @@
 static GnomeVFSResult
 do_path_transfer_command (FtpConnection *conn, gchar *command, GnomeVFSURI *uri, GnomeVFSContext *context) 
 {
+	GnomeVFSURI *dir;
+	GnomeVFSCancellation *cancellation;
 	char *path;
+	char *base;
 	char *actual_command;
 	GnomeVFSResult result;
 
-	/* as some point we may need to make this execute a CD and then
-  	 * a command using the basename rather than the full path. I am yet
-	 * to come across such a system.
-	 */
+	/* if we have a path execute a CWD and perform the command
+	 * on the basename */
 	path = gnome_vfs_unescape_string (uri->text, G_DIR_SEPARATOR_S);
 
+	result = GNOME_VFS_OK;
 	if (path == NULL || path[0] == '\0') {
 		actual_command = g_strconcat (command, " /", NULL);
 	} else {
-		actual_command = g_strconcat (command, " ", path, NULL);
+		dir = gnome_vfs_uri_get_parent (uri);
+		cancellation = get_cancellation (context);
+		result = do_path_command (conn, "CWD", dir, cancellation);
+		actual_command = NULL;
+		gnome_vfs_uri_unref (dir);
+
+		if (result == GNOME_VFS_OK) {
+			base = g_path_get_basename (path);
+			actual_command = g_strconcat (command, " ", base, NULL);
+			g_free (base);
+		}
 	}
 	g_free (path);
-
-	result = do_transfer_command (conn, actual_command, context);
+	if (result == GNOME_VFS_OK) {
+		result = do_transfer_command (conn, actual_command, context);
+	}
 	g_free (actual_command);
 	return result;
 }
